<div dir="ltr">I'm getting this error after compiling from source<div><br></div><div><div>Exception thrown: 'System.MethodAccessException' in gdal_csharp.dll</div><div><br></div><div>Additional information: Attempt by security transparent method 'OSGeo.GDAL.Gdal.UseExceptions()' to call native code through method 'OSGeo.GDAL.GdalPINVOKE.UseExceptions()' failed.  Methods must be security critical or security safe-critical to call native code.</div></div><div><br></div><div>I did </div><div>nmake -f <a href="http://makefile.vc">makefile.vc</a> clean && nmake -f <a href="http://makefile.vc">makefile.vc</a> MSVC_VER=1600 DEBUG=1 && nmake -f <a href="http://makefile.vc">makefile.vc</a> install<br></div><div>cd swig</div><div>nmake -f <a href="http://makefile.vc">makefile.vc</a> csharp</div><div><br></div><div>I get the gdal dll + the csharp dlls...and I use them</div><div><br></div><div>But as soon as I call OSGeo.GDAL.Gdal.UseExceptions(); I get the exception</div><div><br></div><div>This doesn't happen with the dll's I've downloaded from <a href="http://www.gisinternals.com/">http://www.gisinternals.com/</a></div><div><br></div><div>I got the source from <a href="https://trac.osgeo.org/gdal/wiki/DownloadSource">https://trac.osgeo.org/gdal/wiki/DownloadSource</a> and I got 2.0.1</div></div>