API Support Forum
OEC API > API Support > C++ COM Wrapper CancelOrder Not Functioning
Author Topic: C++ COM Wrapper CancelOrder Not Functioning
(38 messages, Page 2 of 2)
Moderators: VPfau
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jun 11, 2020 @ 01:49 PM             Msg. 2 of 38
Shoot that didn't seem to work either.

I just removed the registry keys inside of HKEY_CLASSES_ROOT, do you think I should try removing the keys from the other trees that pertain to GFAPI?
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jun 11, 2020 @ 02:00 PM             Msg. 4 of 38
Never mind, the remaining items are all referencing the downloaded installer.

Could it be due to the fact I have the OECAPICOM still on my machine? Do I need to uninstall and remove that from the registry?
JSmith5611
Posts: 187
Joined:


Posted: Jun 11, 2020 @ 02:48 PM             Msg. 6 of 38
They have different library UUIDs, so they shouldn't conflict.
Jason Smith
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jun 12, 2020 @ 01:41 PM             Msg. 8 of 38
Anything else you can think of? Possibly a compiler issue or something that I am not seeing? Is there any specific setting that needs to be added int he compiler?

I am just not wrapping my head around why everything else but these three work fine. I feel like if it was a compiler issue, it would have this issue on all of the callbacks.
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jun 16, 2020 @ 01:04 PM             Msg. 10 of 38
I downloaded the DebugDiag tool from Microsoft and took a crash dump when the application crashed and it came back with this callstack:

[[HelperMethodFrame_1OBJ] (System.Runtime.InteropServices.Marshal.GetIDispatchForObjectNative)] System.Runtime.InteropServices.Marshal.GetIDispatchForObjectNative(System.Object, Boolean)
mscorlib_ni!System.Runtime.InteropServices.Marshal.GetIDispatchForObject(System.Object)+d
mscorlib_ni!System.Runtime.InteropServices.DispatchWrapper..ctor(System.Object)+31
mscorlib_ni!System.RuntimeType.WrapArgsForInvokeCall(System.Object[], Int32[])+308
mscorlib_ni!System.RuntimeType.ForwardCallToInvokeMember(System.String, System.Reflection.BindingFlags, System.Object, Int32[], System.Runtime.Remoting.Proxies.MessageData ByRef)+12d
[[GCFrame]]
[[ComPlusMethodFrame] (GF.Api.COM.Logging.ILoggingApiEvents.ErrorOccurred)] GF.Api.COM.Logging.ILoggingApiEvents.ErrorOccurred(GF.Api.COM.IGFComClient, System.Exception)
GF.Api.COM.Logging.LoggingApi.Native_ErrorOccurred(GF.Api.IGFClient, GF.Api.Utils.ErrorEventArgs)+35
GF.Api.Impl.Events.EventStore.GF.Api.Impl.Events.IRaiseApiErrorEvent.Raise(GF.Api.Exceptions.GFException)+36
GF.Api.Impl.Connection.HandleException.Handle(GF.Api.Exceptions.GFException, System.String)+14
GF.Api.Impl.Connection.HandleException.Handle(System.Exception)+50
GF.Api.Impl.Threading.AdvanceApi.Advance()+64
GF.Api.Impl.Threading.ThreadingApi.Advance()+c
GF.Api.Threading.GFClientRunner.b__3_0()+20
mscorlib_ni!System.Threading.ThreadHelper.ThreadStart_Context(System.Object)+a1
mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+c4
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+17
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+44
mscorlib_ni!System.Threading.ThreadHelper.ThreadStart()+47

A little more information it provided:

In test.dmp the assembly instruction at KERNELBASE!RaiseException in C:\Windows\System32\KERNELBASE.dll from Microsoft Corporation has caused a CLR Exception on thread 27 with the following error information:

Type: System.InvalidCastException
Message: Specified cast is not valid.

Does this help out at all?
JSmith5611
Posts: 187
Joined:


Posted: Jun 26, 2020 @ 07:49 AM             Msg. 12 of 38
I'll take another look.
Jason Smith
JSmith5611
Posts: 187
Joined:


Posted: Jun 26, 2020 @ 09:31 AM             Msg. 14 of 38
So.. I have found A problem with GFAPI, and i think it may be (at least part of) your problem.

An oddity of COM that i simply didn't know about... you can't pass any subclasses of System.Exception through COM.
So when GFComClient.Logging.OnError would occur, it would crash since every exception we would pass through was a subclass.

I may be able to get a fix released this week, but if not, next .
Jason Smith
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jun 26, 2020 @ 01:00 PM             Msg. 16 of 38
This is great news. I appreciate all of your hard work throughout this process.

It is sounding promising. I'll look for the update and let you know if it has fixed my problem.

Thanks again!
JSmith5611
Posts: 187
Joined:


Posted: Jul 06, 2020 @ 07:57 AM             Msg. 18 of 38
GF COM 4.0.1.47 is available, and hopefully will solve your issue
Jason Smith
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 06, 2020 @ 11:46 AM             Msg. 20 of 38
Thank you very much. I will give it a shot and post back here with the results.

It looks like the 64 bit version is live, but when I get the 32 bit version, it still is giving me 4.0.1.42

I use the 32 bit version.

Thanks
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 08, 2020 @ 12:10 PM             Msg. 22 of 38
Do you have an ETA on when the 32 bit COM Wrapper 4.0.1.47 will be available?

Thanks.
JSmith5611
Posts: 187
Joined:


Posted: Jul 08, 2020 @ 12:18 PM             Msg. 24 of 38
it should be available now
Jason Smith
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 08, 2020 @ 12:28 PM             Msg. 26 of 38
When I download from here: https://gainfutures.com/gainfuturesapi/documentation/ the 64 bit version downloads the 1.0.1.47, but the 32 bit is still downloading 1.0.1.42
JSmith5611
Posts: 187
Joined:


Posted: Jul 08, 2020 @ 12:34 PM             Msg. 28 of 38
That's very odd.. for me it's downloading 4.0.1.47 just fine
Jason Smith
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 08, 2020 @ 12:35 PM             Msg. 30 of 38
Sorry I had to clear my cache and cookies for some reason. I got it downloaded.

I'll let you know if it fixes my issue. Thanks.
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 08, 2020 @ 12:47 PM             Msg. 32 of 38
Initial testing there is no crash!

I am getting a rather lengthy error message that says the server threw an exception of (RPC_E_SERVERFAULT)

Here is the entire error message when closing a position of ESU20

The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at GF.Api.COM.Accounts.IAccountsApiEvents.AvgPositionChanged(IGFComClient client, IAccount account, IPosition contractPosition)
at GF.Api.COM.Accounts.AccountsApi.Native_AvgPositionChanged(IGFClient client, PositionChangedEventArgs e)
at GF.Api.Impl.Events.EventStore.GF.Api.Impl.Events.IRaiseAvgPositionChangedEvent.Raise(Account account, Position contractPosition)
at GF.Api.Impl.Positions.ProcessPosition.c__DisplayClass10_1.b__2()
at GF.Try.Execute(Action action, Action`1 onException)
JSmith5611
Posts: 187
Joined:


Posted: Jul 08, 2020 @ 12:53 PM             Msg. 34 of 38
Ok.
Judging by what i fixed I was expecting something like this (the source of the crash implied that there was another error somewhere, but completely obfuscated the source).

I know this seems like an odd request, but due to the way our issue tracking works, can you post this error in a new topic?
Jason Smith
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 08, 2020 @ 12:54 PM             Msg. 36 of 38
Absolutely. I appreciate all of your help, seriously.