API Support Forum
OEC API > API Support > C++ COM Wrapper Error Message when Closing a Position
Author Topic: C++ COM Wrapper Error Message when Closing a Position
(4 messages, Page 1 of 1)
Moderators: VPfau
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 08, 2020 @ 12:57 PM             Msg. 1 of 4
When closing a position using the 32 bit C++ COM Wrapper version 1.0.1.47, I am receiving an 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 09, 2020 @ 01:14 PM             Msg. 2 of 4
Just in case, can you comment out everything that your listener for AvgPositionChanged does, and see if the exception still occurs?
Jason Smith
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Jul 17, 2020 @ 11:31 AM             Msg. 3 of 4
I'm very sorry I didn't see this come in, I must not have subscribed to the topic.

After commenting everything out in the AvgPositionChanged the error message does not occur.
JSmith5611
Posts: 187
Joined:


Posted: Jul 17, 2020 @ 11:48 AM             Msg. 4 of 4
Judging by the call stack, and the fact that the error no longer happens when your AvgPositionChanged handler is commented out.. I think the problem is in that handler.

Something in that function is throwing an exception.
Jason Smith