Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing with .Net 3.5 test project does not works with VS 2012

I have a Visual Studio 2012 in which I have (let's be simple) 2 projects :

  • MyProject (class library)
  • MyProject.Test (MS Test project)

Because I have to target .Net 3.5, I retarget the test project's framework.

However, at this point, unit testing stopped to works (if I leave 4.5, it works).

Specifically, QTAgent.exe crashes:

[Window Title]
QTAgent.exe

[Main Instruction]
QTAgent.exe has stopped working

[Content]
A problem caused the program to stop working correctly. Please close the program.

[Close the program] [Debug the program]

In the output window of Visual Studio, I can see :

'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.clr20.exe', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.Core.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\SMDiagnostics\3.0.0.0__b77a5c561934e089\SMDiagnostics.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink\3.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll', Symbols loaded.
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.Utilities.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.Measurement\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.Measurement.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.dll', Symbols loaded.
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TmiAdapter.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamSystem.Licensing.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Symbols loaded.
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Enterprise.AspNetHelper.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.ExecutionCommon\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.TMI\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.TMI.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Tip\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Tip.dll', Symbols loaded.
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'Microsoft.VisualStudio.TestTools.Exceptions.EqtDataException' occurred in Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll
A first chance exception of type 'Microsoft.VisualStudio.TestTools.Exceptions.EqtDataException' occurred in Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Projects\_Shared\MyCorp.Shared\Src\MyCorp.MyProject\MyCorp.MyProject.Test\bin\Debug\MyCorp.MyProject.Test.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.Controller.SpooledJob.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.ControllerObject\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.ControllerObject.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.AgentProcessManager\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.AgentProcessManager.dll', Symbols loaded.
'vstest.executionengine.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Runtime.Remoting\2.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\QTAgent_35.exe', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.ExecutionCommon\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.AgentObject\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.AgentObject.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Runtime.Remoting\2.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.AgentProcessManager\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.AgentProcessManager.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamSystem.Licensing.dll', Symbols loaded.
'QTAgent_35.exe' (Managed (v2.0.50727)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Enterprise.AspNetHelper.dll', Symbols loaded.
The program '[7756] QTAgent_35.exe: Managed (v2.0.50727)' has exited with code -1073740940 (0xc0000374).
The thread 'TestAgentProcessMonitor' (0x1854) has exited with code 0 (0x0).
The thread 'Local run message listener test message receiver cleanup thread' (0x2110) has exited with code 0 (0x0).
A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualStudio.QualityTools.ControllerObject.dll
The thread 'Controller: Release worker thread for agent SP2010' (0x18ac) has exited with code 0 (0x0).
A first chance exception of type 'System.Threading.ThreadInterruptedException' occurred in Microsoft.VisualStudio.QualityTools.ControllerObject.dll
The thread 'Controller: heartbeat thread' (0x1db0) has exited with code 0 (0x0).
The thread 'Controller: state execution thread for run d7a5f846-868c-486b-ae22-40d27396a225' (0x1e1c) has exited with code 0 (0x0).
The thread 'Controller: run queue thread' (0x23ec) has exited with code 0 (0x0).
The thread 'Controller: deployment queue thread' (0x25ec) has exited with code 0 (0x0).
The thread '<No Name>' (0x128c) has exited with code 0 (0x0).
The thread '<No Name>' (0x2028) has exited with code 0 (0x0).
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
The program '[6200] vstest.executionengine.clr20.exe: Managed (v2.0.50727)' has exited with code 0 (0x0).

If I attach a debugger to the QTAgent.exe process, I can see this stacktrace:

Stacktrace

Does someone has a idea why my setup does not works, and how to fix it?

For a bit of background, I'm creating SharePoint 2010 unit tests, so I setup the test project to target .Net 3.5 (SharePoint does not works with the CLR 4).

I also set up the test project to run in a 64 bits host.

like image 714
Steve B Avatar asked Jul 16 '13 08:07

Steve B


1 Answers

I actually can't explain why, but I delete the mysolution.v11.suo file, the tests started to works.

Actually, the difference is that I no more have a test setting file (.testsettings).

I had to remove the suo file, because VS 2012 does not allow to deselect a test setting file.

I also had to force the X64 mode (a requirement of my hosting application, SharePoint). but this time, instead of setting the mode in the test sesttings file, I set using TEST->TEST SETTINGS->DEFAULT PROCESSOR ARCHITECTURE-> X64

like image 187
Steve B Avatar answered Nov 15 '22 06:11

Steve B