Menu

#89 Cannot pass a GCHandle across AppDomains error

open
nobody
None
5
2012-05-09
2012-05-09
No

In QuickFIX, I’m attempting to run the C# sample called OrderTest.cs and the call to Thread.Sleep in the Setup function is followed by this invocation:

FIX::UtcTimeStamp* delegateResult = (FIX::UtcTimeStamp*)m_getCreationTimeDelegate->Invoke();

Followed by the the following error in gcroot.h:

System.ArgumentException was unhandled
Message="Cannot pass a GCHandle across AppDomains.\r\nParameter name: handle"
Source="mscorlib"
ParamName="handle"
StackTrace:
at System.Runtime.InteropServices.GCHandle.InternalCheckDomain(IntPtr handle)
at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
at System.Runtime.InteropServices.GCHandle.op_Explicit(IntPtr value)
at gcroot<GetCreationTimeDelegate ^>.->(gcroot<GetCreationTimeDelegate ^>* ) in c:\program files\microsoft visual studio 9.0\vc\include\msclr\gcroot.h:line 120
at MessageStore.getCreationTime(MessageStore* , UtcTimeStamp* ) in c:\dev\3rd\fix\quickfix-1.13.3\quickfix\src\.net\messagestore.h:line 256
InnerException:

Actually, any reworking of the setup code, by say removing the Thread.Sleep call and just spinning in a while loop waiting for application to logon (which by the way, is not logging on), causes that same function in Messagestore.h to get called and then the GC handle error is shown.

Curiously, getCreationTime executes once without error and fails on the second attempt.

BTW, I’ve tried both VS9 and VS10 solution versions and got the same error.

Discussion


Log in to post a comment.