mardi 15 septembre 2015

SQL 2005 and SQL 2012 connections not allowed in single process?

I have break down my problem into small sample. Say I have two C# projects:

  1. One project (let's name SQL2012 project) create database in SQL 2012 (using SQL 2012 SMO's)
  2. Another have same code but it create database in SQL 2005 (obviously using SQL 2005 SMO's). Let's name it SQL2005 project.

If I have strong reference of SQL2005 project in SQL2012 project and I create database one after other (first SQL2012 and then SQL2005), everything work fine (i.e. database created in SQL2012 and SQL2005 servers successfully).

However, if I load SQL2005 assembly using reflection and then try to create SQL2005 database after SQL2012 project, 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.





Aucun commentaire:

Enregistrer un commentaire