MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData
Might be you are trying to access main thread object or UI thread object in a asynchronous function.because asynchronous function's thread has lower priority so you cant access the main thread object from here..