I have break down my problem into small sample. Say I have two C# projects:
SQL2012
project) creates a database in SQL Server 2012 (using SQL Server 2012 SMO's)SQL2005
project.If I have strong reference of SQL2005
project in SQL2012
project and I create database one after other (first SQL Server 2012 and then SQL Server 2005), everything works fine (i.e. databases are created in SQL Server 2012 and SQL Server 2005 successfully).
However, if I load SQL2005
assembly using reflection and then try to create the SQL Server 2005 database after the SQL2012
project run, the application crashes without any stack trace.
I even tried loading it assembly in separate AppDomain but the problem persists (I was suspecting it was because of different version of SMO's but still no success.)
Application stops abruptly without any proper message. However, I see this error in window event logs:
Faulting application name: SQLTest.vshost.exe, version: 12.0.21005.1, time stamp: 0x524fac12
Faulting module name: mscorwks.dll, version: 2.0.50727.8009, time stamp: 0x53a1205c
Exception code: 0xc000000d
Fault offset: 0x00000000002b98b7
Faulting process id: 0x2c28
Faulting application start time: 0x01d0f038dddd568b
Faulting application path: D:\POC's\SQLTest\SQLTest\bin\Debug\SQLTest.vshost.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Report Id: 33bb1220-5c2c-11e5-bef9-74e5434ea1a2
Faulting package full name: Faulting package-relative application ID:
I do not understand that why it comes only in case assembly is loaded via reflection. Any clues? Let me know if question still needs more explanation.
User contributions licensed under CC BY-SA 3.0