2012-08-02

0xC0000005 ACCESS_VIOLATION

ODP.NET: Runtime error / 0xC0000005 Access Violation During Execution of 64bit .NET Application using 32bit ODP.NET [ID 779482.1]
Applies to:
Oracle Data Provider for .NET - Version: 9.2.0.1.0 to 11.1.0.7.0





Symptoms
Using Visual Studion .NET to generate 64bit .NET application by usage of build target "Any CPU" and in combination with 32bit Oracle Client and Oracle Data Provider for .NET (ODP.NET) gives the following error on Windows 64bit (EM64T/AMD64)

The runtime has encountered a fatal error. The address of the error was at <address>, on thread <threadid>. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Same code words with same build targed on Windows 32bit
Cause
The application was build with the wrong build target (AnyCPU). It musst be ensured that ODP.NET, build target and OS are matching. See following matrix:
Build Target Runtime OS ODP.NET Result
AnyCPU 64bit 32bit Access Violation
x86 64bit 32bit Works
x64 64bit 32bit Access Violation
AnyCPU 64bit 64bit Works
AnyCPU 32bit 32bit Works


Solution
To implement the solution, please execute the following steps:

Adjust in project settings build target from "Any CPU" / "x64" to "x86" and rebuild application

or

Install 64bit Oracle Client including 64bit ODP.NET
References
http://msdn.microsoft.com/en-us/library/zekwfyz4.aspx

Niciun comentariu:

Trimiteți un comentariu