View Ticket
Not logged in
Ticket UUID: 894468edb7d4a3afc81305664e730c72b4eaba81
Title: SQLiteFactory throws AppDomainUnloadedException when I execute a VS2010-unit test twice
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: None Resolution: Fixed
Last Modified: 2011-09-30 09:00:18
Version Found In:
using VS2010
1. Create a TestProject 
2. Create an EntityFramework model with one entity
3. Create a unit test:
public class UnitTest1
	public void TestMethod1()
		var conStr = ConfigurationManager.ConnectionStrings["StorageEntities"].ConnectionString;

	private static void doTest(string conStr)
		using (var storage = new StorageEntities(conStr))
			storage.ExecuteStoreCommand("SELECT * FROM [SystemInfo]");
4. add app.config:
			<remove invariant="System.Data.SQLite"/>
			<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
		<add name="StorageEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=_full_path_to_database_file_;BinaryGUID=False&quot;" providerName="System.Data.EntityClient"/>

5. Create a new connection in Server Explorer, create a database-file and create table inside it via Query window:
	[MajorVersion] integer   NOT NULL ,
	[MinorVersion] integer   NOT NULL 
 , PRIMARY KEY ([MajorVersion], [MinorVersion]));

6. Run the unittest. It'll pass
7. Run the unittest one more time. It'll fail with the following exception:
Test method SQLiteAppDomainUnloadException.UnitTest1.TestMethod1 threw exception: 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Data.SQLite.SQLiteFactory' threw an exception. ---> System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.


On evetything works fine. Please fix ASAP. Thanks

<hr /><i>mistachkin added on 2011-09-30 09:00:18 UTC:</i><br />
Already fixed by check-in [1d955a6031].  Soon to be released as version