This project is read-only.

Errors trying to load GDAL Plugins

Oct 12, 2010 at 9:51 PM
Edited Oct 12, 2010 at 9:58 PM

I created a simple MW6 Dummy project by adding references to all of the DotSpatial.*.dll files in the latest release (Sep 27, 2010). I added an appmanager and a map to my form. I then put the Plugins folder in the output directory.  I want to be able to read large .tif and .ecw files, but these plugins arent loading correctly. i just get a mess of a million errors when the program loads, and the .tif and .ecw still won't load:

Windows Vista. Visual Studio 2010. Project is .NET 4.0

 

'MW6Dummy.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\MW6Dummy.exe', Symbols loaded.'MW6Dummy.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\DotSpatial.Controls.dll', Symbols loaded.'MW6Dummy.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\DotSpatial.Symbology.dll', Symbols loaded.'MW6Dummy.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\DotSpatial.Topology.dll', Symbols loaded.'MW6Dummy.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\DotSpatial.Data.dll', Symbols loaded.'MW6Dummy.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\DotSpatial.Serialization.dll', Symbols loaded.A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll'MW6Dummy.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.Skipping non .Net library: Apps\GDAL\adrg.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\bgd.dllA first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dllSystem.IO.FileLoadException: Could not load file or assembly 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\DotSpatial.Data.Rasters.GdalExtension.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)File name: 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\DotSpatial.Data.Rasters.GdalExtension.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   at DotSpatial.Controls.TokenManager.UpdateAssembly(String assemblyPath) in C:\Dev\DotSpatial\DotSpatial.Controls\TokenManager.cs:line 123

A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\dtcanada.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\dted.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\dtusa.dllA first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dllSystem.IO.FileLoadException: Could not load file or assembly 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\gdalconst_csharp.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)File name: 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\gdalconst_csharp.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   at DotSpatial.Controls.TokenManager.UpdateAssembly(String assemblyPath) in C:\Dev\DotSpatial\DotSpatial.Controls\TokenManager.cs:line 123

A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gdalconst_wrap.dllA first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dllSystem.IO.FileLoadException: Could not load file or assembly 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\gdal_csharp.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)File name: 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\gdal_csharp.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   at DotSpatial.Controls.TokenManager.UpdateAssembly(String assemblyPath) in C:\Dev\DotSpatial\DotSpatial.Controls\TokenManager.cs:line 123

A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gdal_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gdal_wrap.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gdk-1.3.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\geos_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\geotiff_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\glib-1.3.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gmodule-1.3.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gnu-intl.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gthread-1.3.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gtk-1.3.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gtkextra-0.99.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\gtkglarea.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\hdf5dll.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\hdf_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\iconv.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\jpeg_osgeo.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libcurl.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libeay32.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libexpat.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libfcgi.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libmap.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libmysql.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libpq.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libtiff_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\libxml2.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\lodbc.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\lti_dsdk_cdll.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\lti_dsdk_dll.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\mapscript.dllA first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dllSystem.IO.FileLoadException: Could not load file or assembly 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\mapscript_csharp.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)File name: 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\mapscript_csharp.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   at DotSpatial.Controls.TokenManager.UpdateAssembly(String assemblyPath) in C:\Dev\DotSpatial\DotSpatial.Controls\TokenManager.cs:line 123

A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\mfhdf_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\msvcp60.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\msvcp70.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\msvcp71.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\msvcr71.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\msvcrt.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\NCScnet_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\NCSEcwC_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\NCSEcw_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\NCSUtil_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\netcdf.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\ogdi_32b1.dllA first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dllSystem.IO.FileLoadException: Could not load file or assembly 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\ogr_csharp.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)File name: 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\ogr_csharp.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   at DotSpatial.Controls.TokenManager.UpdateAssembly(String assemblyPath) in C:\Dev\DotSpatial\DotSpatial.Controls\TokenManager.cs:line 123

A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\ogr_wrap.dllA first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dllSystem.IO.FileLoadException: Could not load file or assembly 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\osr_csharp.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)File name: 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\osr_csharp.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   at DotSpatial.Controls.TokenManager.UpdateAssembly(String assemblyPath) in C:\Dev\DotSpatial\DotSpatial.Controls\TokenManager.cs:line 123

A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\osr_wrap.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\proj.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\pthread.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\python23.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\remote.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\rpf.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\skeleton.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\sqlite3.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\ssleay32.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\szlibdll.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\vrf.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\xerces-c_2_7.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\xerces-depdom_2_7.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\zlib1.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\zlib_fw.dllA first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dllSkipping non .Net library: Apps\GDAL\zlib_osgeo.dllA first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dllSystem.IO.FileLoadException: Could not load file or assembly 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\zh-CN\DotSpatial.Data.Forms.resources.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)File name: 'file:///C:\Visual Studio Projects\MW6Dummy\MW6Dummy\bin\Release\Apps\GDAL\zh-CN\DotSpatial.Data.Forms.resources.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   at DotSpatial.Controls.TokenManager.UpdateAssembly(String assemblyPath) in C:\Dev\DotSpatial\DotSpatial.Controls\TokenManager.cs:line 123

Oct 12, 2010 at 9:58 PM
Edited Oct 12, 2010 at 9:59 PM

Set your build to x86 instead of 64.  Some of the bad image format exceptions will happen regardless, that is what is supposed to happen to the C++ binaries that are not .Net.  However, if you are running in 64, then ALL the GDAL libraries will fail, even the ones in C#.  It uses C# linkages published by the GDAL team and I don't have 64 bit versions of the libraries yet.  I'm not sure anyone is publicly publishing them.  You may have to open the configuration manager and where the x64 setting is visible, you will have to "Add" a new option, give it the name x86 or x32 or whatever name you like, but toggle that the platform to be x86.  Make sure all your projects are set to x86 and then recompile and run the test.

Ted

Oct 12, 2010 at 10:00 PM
Edited Oct 12, 2010 at 10:36 PM

My OS is 32 bit only, and the project is set to build as x86 already.

 

I'm also getting errors with the Map which might be related.  When loading a map via the designer i get a "System.EntryPointNotFoundException". The error was in a message box and the lines of code it references are:

MapLayerEnumerator.cs:line 70

MapFrame.cs:line 386

MapFrame.cs:line 447

mapFrame.cs:line 358

Map.cs: line 1054

Map.cs: line 111

I had to manually add the map in the Form1.Designer.cs file.

 

Edit: I just tried all of this on my Windows 7 x64 computer (which has never had MapWindow 4, MapWindow 6, or DotSpatial on it ever).  I set the build to x86 on that, but no dice. Same problems.  The map issue isn't happening on that computer, but it still isnt loading .ecw files.

 

Dec 20, 2010 at 6:14 AM

The new GDAL Data extension has successfully loaded some ecw and jpeg2000 files - Did the new GDAL support fix your problem?

Dec 20, 2010 at 4:24 PM

I may be loading the plugins wrong, but i get a System.ApplicationException: "The specified file type is not supported."  whenever i try and load an ecw file into the map. I am using the latest x86 .net 4.0 build from 12/15 i think.

Dec 20, 2010 at 4:48 PM

Can you provide a link to a sample file? I can test it and tell you if it's the file, GDAL or your app thats causing the problem.

You could also try:

  1. In the DotSpatial solution configuration manager make sure the correct configuration (Debug/Release) and platform (x86) is selected and check that the DotSpatial.Data.Rasters.Gdal1-7Extension32 project is enabled and the DotSpatial.Data.Rasters.GdalExtension DotSpatial.Data.Rasters.Gdal1-7Extension64 projects are disabled from the build.
  2. Clean the solution and rebuild DotSpatial.
  3. Copy the plugins folder from the DS output folder you just built to the same relative position of your application.
Dec 20, 2010 at 5:29 PM
Edited Dec 20, 2010 at 5:43 PM

I actually was using the prebuilt DotSpatial form the downloads section, but i can try these steps you laid out and see if that helps.  The ecw files i am using open correctly in the MapWindow4 desktop application, so i don't think they are to blame.  If it turns out we can't figure out the problem, I guess i could always create a small ecw file cropped from one of the ones I'm using so its small and upload it. Where would be the best place to upload it?

These are the steps i took in creating the DotSpatial Application. Let me know if i did something wrong:

1. Open VS 2010 and create a new .NET 4.0 Windows Form project

2. Add reference to all DotSpatial.*.dll files from the latest x86 .NET 4.0 prebuilt binaries

3. Change project from .NET 4.0 Client Profile to plain old .NET 4.0 (This is important step, as my VS 2010 defaults to Client Profile which isn't compatible with DotSpatial)

4. Add a Map Control to the Form1 in the designer

5. Add an ApplicationManager via the designer

6. Add a button to the Form1

7. In the button1_click event, load the ecw file from a static location

 

        private void button1_Click(object sender, EventArgs e)
        {
            map1.Layers.Add(@"filename.ecw");
        }

 

 

8. Copy the "Data Extensions" folder as is to the bin/Debug folder of my application

9. Make sure the build is set to Debug x86

10. Run the program in debug mode

11. Click the button attempting to load ecw file. Fails with System.ApplicationException: "The specified file type is not supported."

Dec 20, 2010 at 8:31 PM

It should work, but a way to test if the GDAL plugin is working is to drag and drop a SpatialToolStrip onto your form, set the Map property on the toolstrip.  Then run the application and use the green plus button with the toolstrip.  Use the drop-down at the bottom to look at the various supported file formats.  If there is no entry that says something about GDAL, then we need to figure out why your GDAL plug-in is not working.  If GDAL is listed but the file still isn't supported, then this might be more related to figuring out why the variant that you have doesn't seem to support ecw.  By far the weakest link is getting the app to successfully recognize the plug-in, since there are lots of subtle things that can go wrong.  If, for instance, there are versions of DotSpatial libraries in your DataExtensions folder, it may reference those rather than the file that your project is actually referencing, which means the type recognition will fail.  It sounds like you are accounting for the x86, x64 stuff, and I don't think you will have any 3.5 issues since you are building for 4.0.

Ted

 

 

 

Dec 20, 2010 at 8:57 PM

I tried what you said about the SpatialToolStrip and no GDAL related entries were in the drop down box.

When the app manager loads, it gets two main types of errors.  Pretty much very similar to the giant error dump i listed in my first post from a while back. (Though the output is different with this new DS, it only outputs the error, and no explanation):

BadImageFormatException - There are a lot of these, I assume it is just standard since they are not .NET dlls. Here is the explanation for the first time it happened:

Could not load file or assembly 'cairo.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

FileLoadException - There are a few of these as well, but I checked and the files it says it can't find really do exist, so there must be a problem with their dependencies. Here is the first occurance:

Could not load file or assembly 'file:///c:\Visual Studio Projects\MW6Test122010\MW6Test122010\bin\Debug\Data Extensions\GDAL\DotSpatial.Data.Rasters.GdalExtension.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

 

I wonder if something in my path, or something else i have installed like FWTools could be interfering with it.

Dec 21, 2010 at 4:01 AM

I agree that it doesn't look like a .ecw file format compatability issue so there probably isn't much point in providing a sample.

Don't worry about the Bad Image Format exceptions it's just DotSpatial trying to load the dlls as a managed plugin or data provider. I think this is normal behaviour.

Your problem looks very much like it's plugin related. If you the GDAL data extension can't load then you won't have support for the GDAL file types like ecw. The message: Could not load file or assembly '... DotSpatial.Data.Rasters.GdalExtension.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) is a dead giveaway.

I notice the path in your "cannot load file or assembly" exception text  says MW6Test is that just a folder name or are you actually using MW6 and not dotspatial? I have to ask even though from your description it of creating your app you clearly state DotSpatial as If you are using Mapwindow6 or a version of DotSpatial pre the GDAL 1.7 data extension then your other FWTools installation may well be the culprit as FWTools installations modify the system environment path variable. Pre the GDAL 1.7 data extension DS used FWTools as did (I think) MW6 and different versions of those dll's on your system will conflict. The new GDAL 1.7 DotSpatial data extension can handle other versions of GDAL and FWTools being installed on the same system as it creates an environment configuration just for the current process and doesn't make or require any system wide changes. Also in your first post you have the GDAL data extension in the \Apps folder I'm pretty sure it needs to be in \Data Extensions\GDAL\ but from your last post it seems you have got that sorted out now.

Before you try anything else I suggest you build DotSpatial from the current source and try to open your file in the DemoMap application checking that GDAL... appears in the supported formats drop down as shade1974 described above.

Dec 21, 2010 at 4:34 AM
Edited Dec 21, 2010 at 4:51 AM

Yeah, sorry for the confusion. Hopefully this will clear it up:

1. MW6Test is just the name of the project. For some reason i still seem to call it that, but I am 100% using DotSpatial. In fact, the last time i used MW6 (quite some time ago), it actually was able to load ecw files, but i have never been able to get the DotSpatial to load them at all.

2. The first post used a DotSpatial prebuilt binaries from Sep 27, 2010.  This is probably as close to the first build of DS i have used if that gives you any inclination on the gdal version. These posts i have been using the prebuilt binaries from  Dec 15th, 2010.  

3. In the first post \Apps folder was just the last place i had the files in. I originally tried Data Extensions, then Plugins, then Apps, and maybe even just plain GDAL. i tried many different names for the folder and folder structures, but nothing fixed it (however it seemed to behave exactly the same error wise as far as i recall).

4. The prebuilt DemoMap does not work with ecws for me, but I can always try building it from source like you suggest and trying that.

5. I have tons of gdal bloat on my computer. I have FWTools, OSGEO4W, Python bindings for GDAL, and a crapload of env variables and directories in my path that have something to do with gdal. I may have to test this on some fresher computers and see what happens.

UPDATE:

I just downloaded the DotSpatial prebuilt binaries (the same one from the past few posts) on my home computer (Windows 7, x64).  I ran the DemoMap application, and right away it had the drop down menu with GDAL raster file formats.  I dont have an ecw file with me to test, but i assume it would work.  It sounds like the problem on the other computer is with my path and or environment variables.  I wonder if there is something to do in order to force it to use a certain set of gdal files from the program.  Possibly like adding the DataExtensions folder to the beginning of the path temporarily on each run of the app?

Dec 21, 2010 at 5:14 AM

 Looks like we're in a similar time zone :)

The binaries you are using are definitely pre the GDAL 1.7 data extension so it's FWTools/GDAL environment conflicts at work here. You can try pre-pending to the path with the correct folder but if you have GDAL bloat from things you still use this will quickly driver [sic] you crazy!

 

Not sure when the next prebuild is happening (shade1974?) but as I mentioned If your game to try building from source following the not very detailed instructions above you can kiss your DLL hell goodbye and glory in the new GDAL 1.7 data extension. Just kidding - it's pretty new so you may just encounter another problem but I have an app doing something very similar to what your trying to do working right now and I have tested some ecw's that kellison provided and they loaded without problems.

Dec 21, 2010 at 3:14 PM

I am not sure what the specific problem is in this case unfortunately.  It sounds like for certain there is a problem with the plugin.  It is finding it ok, or else it would not throw an error about failing to load it.  The plug-in is the correct x86/x64, or else you would just get a bad-image format exception.  Another big one is accidentally getting extra DotSpatial libraries in your DataExtensions/GDAL path, but if you do that you don't get an exception, it just doesn't load the plugin because it fails the interface check.  Be aware that at least one of the prebuilt 3.5 versions was building the GDALPlugin project accidentally into the root directory, but that doesn't seem to be your issue since it is finding the library, but failing to open it, and I think you said you were 4.0, so that eliminates 3.5 problems.  I think you said you copied all the dlls, so that should be ok.  In other words, all those unmanaged dll files are necessary for GDAL to work, so without them the plugin will fail.  I know some programs like proj4 actually require modifying your path parameters before they work correctly.  That is, they use yee-olde pre-windows 7 path specifications which in my personal experience don't work at all on my newer machines.  I have yet to figure out how to get the old proj4 NAD grids to load correctly in the original proj4.dll.  But GDAL has been working without any hitches on my machines, so this seems like GDAL is having trouble on your specific system for reasons, and it does sound like there may be path commands causing some funkyness, but I'm not sure.  Interestingly, I don't think I have any tweaks to my path that would specify anything to do with GDAL directories.  That is, you might be better off removing any path commands that lead to other versions of GDAL, and relying on immediate proximity for finding stuff.  Certainly the DemoMap app should work, and the fact that it doesn't work means that there is something very specific to your configuration that is killing GDAL, but I'm afraid I'm not enough of a GDAL wiz yet to guess what that could be just yet.

I don't plan on pushing a release build until after the holidays.

Ted

 

Dec 22, 2010 at 6:13 PM

I am having a similar issue, I upgraded to the newer version (Dec 15 download) and if I copy the data extensions folder into my project apon initialization I get a BadImageFormatException error (shown below), when I try to step over the error I continue to get additional LoadFromContext, FileLoadExceptions .errors.

However when I run the demo map from the  source code example it works fine.

 

System.BadImageFormatException occurred
  FileName=cairo.dll
  FusionLog=""
  Message=Could not load file or assembly 'cairo.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
  Source=mscorlib
  StackTrace:
       at System.Reflection.AssemblyName.nGetFileInformation(String s)
       at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
       at DotSpatial.Data.DataManager.LoadProvidersFromDirectories() in c:\Dev\DotSpatial\DotSpatial.Data\DotSpatial.Data\DataManager.cs:line 1434
  InnerException: System.BadImageFormatException
       FileName=cairo.dll
       FusionLog=""
       Message=Could not load file or assembly 'cairo.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
       InnerException: 



 

LoadFromContext was detected
Message: The assembly named 'DotSpatial.Data.Rasters.GdalExtension' was loaded from 
'file:///C:/Users/jknewson/Documents/Visual Studio 2010/Projects/mwApp/mwApp/bin/Debug/Data 
Extensions/GDAL/DotSpatial.Data.Rasters.GdalExtension.dll' using the LoadFrom context. 
The use of this context can result in unexpected behavior for serialization, casting and 
dependency resolution. In almost all cases, it is recommended that the LoadFrom context be avoided. 
This can be done by installing assemblies in the Global Assembly Cache or in the ApplicationBase directory 
and using Assembly.Load when explicitly loading assemblies.
System.IO.FileLoadException occurred
  FileName=file:///C:\Users\jknewson\Documents\Visual Studio 2010\Projects\mwApp\mwApp\bin\Debug\Data Extensions\GDAL\DotSpatial.Data.Rasters.GdalExtension.dll
  FusionLog=""
  Message=Could not load file or assembly 'file:///C:\Users\jknewson\Documents\Visual Studio 2010\Projects\mwApp\mwApp\bin\Debug\Data Extensions\GDAL\DotSpatial.Data.Rasters.GdalExtension.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
  Source=mscorlib
  StackTrace:
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.LoadFrom(String assemblyFile)
       at DotSpatial.Data.DataManager.LoadProvidersFromDirectories() in c:\Dev\DotSpatial\DotSpatial.Data\DotSpatial.Data\DataManager.cs:line 1444
  InnerException: System.NotSupportedException
       Message=An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
       InnerException: 
Dec 22, 2010 at 9:16 PM

There could be something else going wrong, but with BadImageFormat exceptions etc. the general problem would be something like this:

The "x64" version is not really x64, but "AnyCPU".  The unmanaged GDAL content, however is x64.  If you are on an x64 machine, this works well since AnyCPU will load up

as an x64 project.  If you are on a 32 bit machine, however, you will run just fine, but it will be running as x86  instead of x64 since the AnyCPU is evaluated at runtime

and selected for your operating system.  The only thing that won't run correctly is the GDAL plugin.  So if you are on an x86 machine, make sure you get the GDAL download

for x86 so that the unmanaged libraries match both the framework of your operating system and the setting on your application.

Ted

 

 

Dec 22, 2010 at 9:18 PM

Also, the unmanaged dll files are not optional.  you need not only the GDAL Plugin itself but all the unmanaged dll libraries.  It's not clear from the exception above if those were found.

Ted

 

Mar 3, 2011 at 5:11 PM

I encountered a similar set of errors when I started to use DotSpatial. The key is this part of the message:

"An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework.

This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous."

When you download the framework or the project, before unzipping the archive, right click on the .zip file and hit Properties. You should see a button near the bottom that says "Unblock" - click this and close.

Proceed unzipping the file, adding the libraries and such, and all should be well.