J
Jerome Lague
Hi all,
I am a newbie in unit testing and i am facing an annoying issue.
My solution containes C#, C++/clr (C++/CLI), and C++ native. I would like to
test a C# project which has C++/clr dependency. My assembly is build from
severals netmodule, some writtens in C#, some in C++/CLI.
When I launch the test from Visual. I got an exception (see exception stack
below).
Actually, if I use mstest and /noisolation, IT WORKS!
I am not sure of understanding this magical argument. MSDN say : "Run tests
within the MSTest.exe process. This choice improves test run speed but
increases risk to the MSTest.exe
process".(http://msdn.microsoft.com/en-us/library/ms182489.aspx)
But in my case, there is not just a matter of speed! It affects the test
process.
So my questions are :
1) What excatly the noisolation does ?
2) How can I avoid the noisolation argument and sucessfully pass my tests ?
3) If the 2) isn't possible, how can I use noisolation arg in visual ?
4) What is the link between my exception and /noisolation ?
Thanks for your replies!
Error message:
Test method TestProject1.UnitTest2.TestMethod1 threw exception:
System.TypeInitializationException: Une exception a été levée par
l'initialiseur de type pour '<Module>'. --->
<CrtImplementationDetails>.ModuleLoadException: The C++ module failed to
load while attempting to initialize the default appdomain.
---> System.BadImageFormatException: The module was expected to contain an
assembly manifest. (Exception de HRESULT : 0x80131018).
Stack trace:
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo)
DoCallBackInDefaultDomain(IntPtr function, Void* cookie) in
f:\dd\vctools\crt_bld\self_x86\crt\src\minternal.h: line 447
DoCallBackInDefaultDomain(IntPtr , Void* )
DefaultDomain.Initialize()
LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* )
LanguageSupport._Initialize(LanguageSupport* )
LanguageSupport.Initialize(LanguageSupport* )
ThrowModuleLoadException(String errorMessage, Exception innerException) in
f:\dd\vctools\crt_bld\self_x86\crt\src\minternal.h: line 224
ThrowModuleLoadException(String , Exception )
LanguageSupport.Initialize(LanguageSupport* )
cctor()
TestProject1.UnitTest2.TestMethod1()
Fusion log viewer report concerning the guilty module:
*** Entrée du journal Binder d'assembly (05/06/2009 @ 11:16:22) ***
L'opération a échoué.
Résultat de liaison : hr = 0x80131018. Aucune description disponible.
Gestionnaire des assemblys chargé à partir de :
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Exécution sous l'exécutable c:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\vstesthost.exe
--- Un journal des erreurs détaillé suit.
JRN : liaison explicite IJW. Chemin d'accès au fichier :
C:\...\UnitTest\TestResults\Results\Out\InventorBase.netmodule.I notice that
when run with the /noisolation switch, I found no entry concerning the
netmodule (the fusion log settings is set to 'Log all binds to disk').It is
like if the netmodule was loaded as an assembly ...
I am a newbie in unit testing and i am facing an annoying issue.
My solution containes C#, C++/clr (C++/CLI), and C++ native. I would like to
test a C# project which has C++/clr dependency. My assembly is build from
severals netmodule, some writtens in C#, some in C++/CLI.
When I launch the test from Visual. I got an exception (see exception stack
below).
Actually, if I use mstest and /noisolation, IT WORKS!
I am not sure of understanding this magical argument. MSDN say : "Run tests
within the MSTest.exe process. This choice improves test run speed but
increases risk to the MSTest.exe
process".(http://msdn.microsoft.com/en-us/library/ms182489.aspx)
But in my case, there is not just a matter of speed! It affects the test
process.
So my questions are :
1) What excatly the noisolation does ?
2) How can I avoid the noisolation argument and sucessfully pass my tests ?
3) If the 2) isn't possible, how can I use noisolation arg in visual ?
4) What is the link between my exception and /noisolation ?
Thanks for your replies!
Error message:
Test method TestProject1.UnitTest2.TestMethod1 threw exception:
System.TypeInitializationException: Une exception a été levée par
l'initialiseur de type pour '<Module>'. --->
<CrtImplementationDetails>.ModuleLoadException: The C++ module failed to
load while attempting to initialize the default appdomain.
---> System.BadImageFormatException: The module was expected to contain an
assembly manifest. (Exception de HRESULT : 0x80131018).
Stack trace:
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo)
DoCallBackInDefaultDomain(IntPtr function, Void* cookie) in
f:\dd\vctools\crt_bld\self_x86\crt\src\minternal.h: line 447
DoCallBackInDefaultDomain(IntPtr , Void* )
DefaultDomain.Initialize()
LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* )
LanguageSupport._Initialize(LanguageSupport* )
LanguageSupport.Initialize(LanguageSupport* )
ThrowModuleLoadException(String errorMessage, Exception innerException) in
f:\dd\vctools\crt_bld\self_x86\crt\src\minternal.h: line 224
ThrowModuleLoadException(String , Exception )
LanguageSupport.Initialize(LanguageSupport* )
cctor()
TestProject1.UnitTest2.TestMethod1()
Fusion log viewer report concerning the guilty module:
*** Entrée du journal Binder d'assembly (05/06/2009 @ 11:16:22) ***
L'opération a échoué.
Résultat de liaison : hr = 0x80131018. Aucune description disponible.
Gestionnaire des assemblys chargé à partir de :
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Exécution sous l'exécutable c:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\vstesthost.exe
--- Un journal des erreurs détaillé suit.
JRN : liaison explicite IJW. Chemin d'accès au fichier :
C:\...\UnitTest\TestResults\Results\Out\InventorBase.netmodule.I notice that
when run with the /noisolation switch, I found no entry concerning the
netmodule (the fusion log settings is set to 'Log all binds to disk').It is
like if the netmodule was loaded as an assembly ...