API Support Forum
OEC API > API Support > Meaning and prevention of API Exception System.InvalidCastException: Specified cast is not valid.
Author Topic: Meaning and prevention of API Exception System.InvalidCastException: Specified cast is not valid.
(3 messages, Page 1 of 1)
Moderators: VPfau
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Oct 05, 2015 @ 07:47 PM             Msg. 1 of 3
I have a customer who has a fresh install of the api. On Login, he encounters this error:

15:36:08.411 Dbg System #1 USERNAME omitted for privacy : API Exception System.InvalidCastException: Specified cast is not valid. at System.Runtime.InteropServices.Marshal.GetIDispatchForObjectNative(Object o, Boolean onlyInContext) at System.Runtime.InteropServices.Marshal.GetIDispatchForObject(Object o) at System.Runtime.InteropServices.DispatchWrapper..ctor(Object obj) at System.RuntimeType.WrapArgsForInvokeCall(Object[] aArgs, Int32[] aWrapperTypes) at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at OECAPICOM._DOECClientEventInterface.OnError(Exception ex) at OECAPICOM.OECClient.HandleAndFireOnError(Exception ex) at OEC.API.OECClient.FireOnError(Exception ex) at OEC.API.Core.HandleCaughtException(ClientResponse response, Exception ex) at OEC.API.Core.EndUpdate(ClientResponse response) at OEC.API.Core.CheckEvents() at OEC.API.Core.VerifyConnection() at OEC.API.OECClient.m_EventsTimer_Tick(Object sender, EventArgs e)

He had to open a chart first before the error occurred.
He has no record of previous installs of OEC Trader in his registry.
File search only found one OECAPICOM.dll.
The user states it took awhile after opening the app, and opening charts, to see the problem.

Do you have any idea why this error might occur?
Any tips on how we could prevent it?

Is m_EventsTimer_Tick used in an api call I am using, like OEC()->GetTickTimer?

I will pass on the log to support, Chris M. and Mr. Pfau.

Thanks,

CHW
JSmith5611
Posts: 187
Joined:


Posted: Oct 06, 2015 @ 10:10 AM             Msg. 2 of 3
What version of the OECAPICOM.dll was installed?

Jason Smith
JSmith5611
Posts: 187
Joined:


Posted: Oct 06, 2015 @ 02:44 PM             Msg. 3 of 3
There is a new COM api build at api.openecry.com that should fix this issue.


Jason Smith
Edited by JSmith5611 on Oct 6, 2015 at 15:08:24