Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gdal.SetConfigOption exception encountered for x64 #2951

Closed
ylimemily opened this issue Sep 18, 2020 · 1 comment
Closed

Gdal.SetConfigOption exception encountered for x64 #2951

ylimemily opened this issue Sep 18, 2020 · 1 comment

Comments

@ylimemily
Copy link

I filed a ticket in build but wasn't sure if that's the correct location to for the issue i encountered so I am filing another one here. My apologies in advance.
gisinternals/buildsystem#160 (comment)

I downloaded gdal 2.4.4 and gdal.native 2.4.4 through nuget.org in a C# project and I am encountering exceptions in Gdal.SetConfigOption calls in GdalConfiguration.cs. The exceptions only occurs if the nativePath variable is set to x64 , it works fine when set to x86. I think this has been raised before in this link but the latest version available in nuget is 2.4.4 and I'm still encountering the issue. So i'm not sure if this has been fixed or is there another version that I can grab from nuget? Thanks.

Trace output:
Exception thrown: 'System.TypeInitializationException' in gdal_csharp.dll
error: System.TypeInitializationException: The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Gdal(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper..cctor()
--- End of inner exception stack trace ---
at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper..ctor()
at OSGeo.GDAL.GdalPINVOKE..cctor()
--- End of inner exception stack trace ---
at OSGeo.GDAL.GdalPINVOKE.SetConfigOption(String jarg1, String jarg2)
at OSGeo.GDAL.Gdal.SetConfigOption(String pszKey, String pszValue)
at TestGdal.GdalConfiguration..cctor() in D:\Visual Studio 2015\Projects\CheckGdal\TestGdal\TestGdal\GdalConfiguration.cs:line 96
error: Executing directory: D:\Visual Studio 2015\Projects\CheckGdal\TestGdal\TestGdal\bin\Debug
error: gdal directory: D:\Visual Studio 2015\Projects\CheckGdal\TestGdal\TestGdal\bin\Debug\gdal
error: native directory: D:\Visual Studio 2015\Projects\CheckGdal\TestGdal\TestGdal\bin\Debug\gdal\x64

@rouault
Copy link
Member

rouault commented Sep 19, 2020

I guess the ticket in gisinternals will do. Looks more like a distribution/usage issue than an upstream one

@rouault rouault closed this as completed Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants