Hello,

I am getting the message "The type initializer for 'OSGeo.OGR.OgrPINVOKE' threw 
an exception." in my C# program that is referencing the ogr_csharp.dll file.  
When trying to instantiate a class that is extended from the OGR.Geometry class 
. After doing some research it appears that the issue is being caused by 64bit 
vs. 32bit architecture. I am running a 64bit Windows 7 machine using Visual 
Studio 2010. I have tried switching the project / solution configuration to be 
x86 as well as Any CPU with the same results. I have also used the 64bit builds 
on http://www.gisinternals.com/sdk/ with the same results. The full stack trace 
is below. Any ideas?


System.Transactions Critical: 0 : <TraceRecord 
xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"; 
Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled
 
exception</Description><AppDomain>SimDBI.vshost.exe</AppDomain><Exception><ExceptionType>System.TypeInitializationException,
 mscorlib, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The type initializer 
for 'OSGeo.OGR.OgrPINVOKE' threw an exception.</Message><StackTrace>   at 
OSGeo.OGR.OgrPINVOKE.new_Geometry(Int32 jarg1, String jarg2, Int32 jarg3, 
IntPtr jarg4, String jarg5)
   at OSGeo.OGR.Geometry..ctor(wkbGeometryType type)
   at SimDBI.Coordinate..ctor() in C:\Projects\SimDBI\SimDBI\Coordinate.cs:line 
42
   at SimDBI.Test.Main() in C:\Projects\SimDBI\SimDBI\Test.cs:line 16
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] 
args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, 
ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, 
ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.TypeInitializationException:
 The type initializer for 'OSGeo.OGR.OgrPINVOKE' threw an exception. 
---&amp;gt; System.TypeInitializationException: The type initializer for 
'SWIGExceptionHelper' threw an exception. ---&amp;gt; 
System.DllNotFoundException: Unable to load DLL 'ogr_wrap': The operating 
system cannot run . (Exception from HRESULT: 0x800700B6)
   at 
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Ogr(ExceptionDelegate
 applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate 
divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, 
ExceptionDelegate invalidCastDelegate, ExceptionDelegate 
invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate 
nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate 
overflowDelegate, ExceptionDelegate systemExceptionDelegate)
   at OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..cctor()
   --- End of inner exception stack trace ---
   at OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..ctor()
   at OSGeo.OGR.OgrPINVOKE..cctor()
   --- End of inner exception stack trace ---
   at OSGeo.OGR.OgrPINVOKE.new_Geometry(Int32 jarg1, String jarg2, Int32 jarg3, 
IntPtr jarg4, String jarg5)
   at OSGeo.OGR.Geometry..ctor(wkbGeometryType type)
   at SimDBI.Coordinate..ctor() in C:\Projects\SimDBI\SimDBI\Coordinate.cs:line 
42
   at SimDBI.Test.Main() in C:\Projects\SimDBI\SimDBI\Test.cs:line 16
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] 
args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, 
ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, 
ContextCallback callback, Object state)
   at 
System.Threading.ThreadHelper.ThreadStart()</ExceptionString><InnerException><ExceptionType>System.TypeInitializationException,
 mscorlib, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The type initializer 
for 'SWIGExceptionHelper' threw an exception.</Message><StackTrace>   at 
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..ctor()
   at 
OSGeo.OGR.OgrPINVOKE..cctor()</StackTrace><ExceptionString>System.TypeInitializationException:
 The type initializer for 'SWIGExceptionHelper' threw an exception. ---&amp;gt; 
System.DllNotFoundException: Unable to load DLL 'ogr_wrap': The operating 
system cannot run . (Exception from HRESULT: 0x800700B6)
   at 
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Ogr(ExceptionDelegate
 applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate 
divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, 
ExceptionDelegate invalidCastDelegate, ExceptionDelegate 
invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate 
nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate 
overflowDelegate, ExceptionDelegate systemExceptionDelegate)
   at OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..cctor()
   --- End of inner exception stack trace ---
   at OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..ctor()
   at 
OSGeo.OGR.OgrPINVOKE..cctor()</ExceptionString><InnerException><ExceptionType>System.DllNotFoundException,
 mscorlib, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Unable to load DLL 
'ogr_wrap': The operating system cannot run . (Exception from HRESULT: 
0x800700B6)</Message><StackTrace>   at 
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Ogr(ExceptionDelegate
 applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate 
divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, 
ExceptionDelegate invalidCastDelegate, ExceptionDelegate 
invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate 
nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate 
overflowDelegate, ExceptionDelegate systemExceptionDelegate)
   at 
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..cctor()</StackTrace><ExceptionString>System.DllNotFoundException:
 Unable to load DLL 'ogr_wrap': The operating system cannot run . (Exception 
from HRESULT: 0x800700B6)
   at 
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Ogr(ExceptionDelegate
 applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate 
divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, 
ExceptionDelegate invalidCastDelegate, ExceptionDelegate 
invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate 
nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate 
overflowDelegate, ExceptionDelegate systemExceptionDelegate)
   at 
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..cctor()</ExceptionString></InnerException></InnerException></Exception></TraceRecord>


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to