chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
0 votes
I have VS2005 Team Edition. In my test, I am creating an instance of a class that I intend to test. When I execute, the 'new' statement throws an exception:

Test method UnitTest2.UnitTest1.TestMethod2 threw exception: System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadExceptionHandlerException: A nested exception occurred after the primary exception that caused the C++ module to fail to load.
---> System.Runtime.Serialization.SerializationException: Serialization error..

The assembly containing the class does have a reference to a C++/CLR (interop) project. When I modify the experiment to instantiate a class in the interop project, I get the same behavior.

When I move the experiment to a simple console project and I can instantiate these classes without error. This would seem to point to a problem with the unit testing environment (vstesthost.exe?). I have made an edit to vstesthost.exe.config to set developerMode = True. To be fair, I added the same setting to my console application with no change in behavior.

I later discovered that the culprit was TypeMock 3.5.1. I then received a reply from TypeMock included below. Please send the indicated patch.

Randall.


I'm part of TypeMock support team.
We fixed the bug you are talking about.
The fix will available to all on our next release (will be within a month from now)
If you need the patch now please register to TypeMock forum at www.typemock.com
post a request and I will send the patch.


Ohad.TypeMock support team.
asked by (2.1k points)

3 Answers

0 votes
Hi Randall
I'm glad you noticed my post 8)
I'm sending the patch. Please check your mailbox.
answered by (35.5k points)
0 votes
No problem.
I will send you the link for the patch.
Check your mail. :shock:
answered by (35.5k points)
0 votes
Received and tested the patch. All is well.

Many thanks,
Randall.
answered by (2.1k points)
...