The type initialized for ‘SingletonCreator’ threw an exception or System.BadImageFormatException

You are using GreatMap.Net (Gmap.net) in visual studio and you eventually have one of those error messages :

  • The type initialized for ‘SingletonCreator’ threw an exception
  • System.BadImageFormatException

Don’t worry there is a solution…

  • The type initialized for ‘SingletonCreator’ threw an exception

Simply add this useLegacyV2RuntimeActivationPolicy=”true” in your app.config file in the <Startup> tag in order to have

 <startup useLegacyV2RuntimeActivationPolicy="true"> 
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
 </startup>

or, for the .net Framework 4.0 Client Profile

 <startup useLegacyV2RuntimeActivationPolicy="true">
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
  • System.BadImageFormatException

use x86 target and you will be ok


Leave a Reply