Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program Stopped working, Problem Event Name: CLR20r3

I am starting my program from release folder. On my Windows 7 64-bit machine it is working.

In virtual machine Windows 7 32-bit it is working.

On third machine with Windows 7 64-bit it is not working.

On every machine I have installed .NET Framework 4, my project use .NET Framework 3.5 because I use SQLite database, and SQLite dll as I understand need for project to be .NET Framework 3.5.

I am using Visual Studio 2010 Express edition, SQLite database.

Here is error from third computer:

Description:
Stopped working

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01:   geotest.exe
Problem Signature 02:   1.0.0.0
Problem Signature 03:   4e58f462
Problem Signature 04:   GeoTest
Problem Signature 05:   1.0.0.0
Problem Signature 06:   4e58f462
Problem Signature 07:   f
Problem Signature 08:   12
Problem Signature 09:   System.BadImageFormatException
OS Version: 6.1.7600.2.0.0.256.1
Locale ID:  1033
like image 350
Ivan Tanasijevic Avatar asked Aug 31 '11 21:08

Ivan Tanasijevic


2 Answers

The Common Language Runtime from version 3.0 onward uses a different method to load a mixed-mode assembly (one containing both managed and native code) like SQLite. Since SQLite was built against the .NET Framework 2.0, we have to specifically tell the CLR to use the old 2.0 way of loading mixed-mode assemblies:

Add (or update) app.config in your project:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

Other questions also reveal more information on this: SQLite-specific / generic explanation

like image 193
hydroiodic Avatar answered Sep 21 '22 03:09

hydroiodic


In release folder there is no System.Data.SQLite.DLL, that was problem. Now when i copy it everything is working.

like image 42
Ivan Tanasijevic Avatar answered Sep 20 '22 03:09

Ivan Tanasijevic