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
0 votes
Hi,

We have migrated our C# Sharepoint project from a 32 bit environment to a 64 bit environment and when we attempt to run our Typemock tests via MSBuild we get the following exceptions and the tests fail:

"TypeInitializationException" The type initializer for 'TypeMock.ArrangeActAssert.Isolate' thew an exception -> ... -> Could not load type 'cn' from assembly 'Typemock, Version=5.3.1.0 ....'

Thanks.
Andrew
asked by aftan (2.5k points)

5 Answers

0 votes
Hi Andrew,

Can you please tell me which test runner are you using?
If you are running the tests via mstest than the problem is that mstest cannot run in 64 bit (it is built as 32 bit assembly).
You can solve that by using other test runner like nunit or xunit which can run in 64 bit.
answered by ohad (35.4k points)
0 votes
Hi Ohad,

We are using MSTest to run our tests via Visual Studio and MSBuild.

When you say that MSTest cannot run in 64bit. Do you mean it cannot run Typemocked tests on a 64 bit environment? As MSTest can run our other unit tests which do not use Typemock?

Thanks.
answered by aftan (2.5k points)
0 votes
Hi Ohad,

The problem is fixed now.

I had Typemock Isolator installed and not Isolator SP.

Within our project we were also referring to a 32bit version of the typemock dll's so I had to update the reference to use the 64bit Typemock dll's.

Thanks for your help.

Andrew
answered by aftan (2.5k points)
0 votes
Hi Andrew,

Glad you got it fixed :)
Just to make things clear - mstest cannot run in 64 bit context without any relation to Typemock. The mstest.exe binary is built as 32 bit binary and hence will not run in 64 bit.
You can check that by using the corflags.exe utility from visual studio command line:
corflags "c:Program Files (x86)Microsoft Visual Studio 9.0Common7IDEMSTest.exe"

You'll get the output:

Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 11
ILONLY : 1
32BIT : 1 <== This tells us the executable is built as 32 bit.
Signed : 1

My guess is that the code you want to test is still running in 32 bit.
answered by ohad (35.4k points)
0 votes
Thanks for clearing that up.
answered by aftan (2.5k points)
...