API Support Forum
OEC API > API Support > .NET Exception: System.AccessViolationException: Attempted to read or write protected memory
Author Topic: .NET Exception: System.AccessViolationException: Attempted to read or write protected memory
(5 messages, Page 1 of 1)
Moderators: VPfau
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Jul 27, 2011 @ 03:49 PM             Msg. 1 of 5
Hi,

We use the OEC COM API and on a Vista Business system we get a Microsoft .NET Framework Unhandled exception error attempting to read or write protected memory.

Vista Business SP 2
.NET Framework 1.1
.NET Framework 2.0 SDK (x64)
.NET Framework 3.5 SP1
.NET Framework 4 Client Profile



See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
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.LoadClient(APIData initdata)
at OEC.API.Core.DispatchClientResponse(ClientResponse response)
at OEC.API.Core.FrontLayer_ResponseReceived(ClientResponse response)
at OEC.API.Layers.ExecutionLayer.SendResponseUp(ClientResponse response)
at OEC.API.Layers.OECConnectionLayer.ReadConnection()


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4214 (VistaSP2GDR.050727-4200)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
OECAPICOM
Assembly Version: 3.5.0.0
Win32 Version: 3.5.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Gecko%20Software/Track%20'n%20Trade%20Live/OECAPICOM.DLL
----------------------------------------
API
Assembly Version: 3.5.0.0
Win32 Version: 3.5.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Gecko%20Software/Track%20'n%20Trade%20Live/API.DLL
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4212 (VistaSP2GDR.050727-4200)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4214 (VistaSP2GDR.050727-4200)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
CommLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Gecko%20Software/Track%20'n%20Trade%20Live/CommLib.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
ProtoSharp.Core
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Gecko%20Software/Track%20'n%20Trade%20Live/ProtoSharp.Core.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jul 28, 2011 @ 09:50 AM             Msg. 2 of 5
Hello,

could you please try to login with the same user credentials via OEC Trader to check the reason of unsuccessful loading?

Regarding System.AccessViolationException: it can be a sign that your application is compiled with different version of OEC COM API. Unfortunately, we do not change CLSID for every minor version of OEC API.

Victor Vins
Lead Software Developer
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Jul 28, 2011 @ 01:08 PM             Msg. 3 of 5
When I launched my installed OEC Trader Demo on the affected system, it did not crash but it gave me this warning:

OEC will be discontinuing support of version 3.4 on January, 1. Please ensure you have downloaded our latest version of OEC Trader 3.5, or, if you have written to the OEC API, please ensure you have updated your interface to support OEC API version 3.5 by this time.

I installed 3.5 on the affected system, it runs fine.

I tried our software again and get the same error.

All copies of our software should be using the same version of the OEC files, but I will check file versions, sizes and checksums to verify.
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Aug 09, 2011 @ 02:48 PM             Msg. 4 of 5
I uninstalled OEC Trader 3.5, and installed OEC Trader 3.5 from OECAPICOM_NoSamples 3.5.exe and the problem seemed to go away.

This seemed to only affect systems with some version of the development API installed. Otherwise the software uses the version in our program's directory which we have built against.

As you say, the version information is very lacking. Looking at two different installers I can't say which is newer. It seems I got the right one in there somehow. Please consider at least tagging installer file names with a release date or adding version info to the installer exe or updating the version number and name.
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: May 31, 2013 @ 08:01 PM             Msg. 5 of 5
The same unique id between minor version updates and no update to the version number (3.5.0.0) for all dlls continues to hamper our development using the OEC API.

The reason why it would be a great idea to perform (industry standard) version number updates (even for "minor" updates) and change the uuid for each new version is because:
- it would allow us to test these dlls side by side
- provide a way for our users to switch between old and new dlls if the new api somehow broke existing functionality in a way that had escaped our testing.

We again request version # updates and new uuids for each API release.

Thanks,

CHW