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
I am getting exception

Could not load file or assembly 'TypeMock, Version=0.0.0.0, Culture=neutral, PublicKeyToken=0000000000000000' or one of its dependencies. The system cannot find the file specified.

after the first call to the Class under test.

I am not using Nunit, just a quick mock up to look at typemock.

LinkedProfile...out file shows

Logging program: C:Documents and SettingsXXXXXDesktopTest.ClassLibraryTest.ConsoleApplicationinDebugTest.ConsoleApplication.vshost.exe
Cannot read EnvName0 => The system cannot find the file specified.

ResetCLSID is empty
Adding typemock profiler
Loaded C:Program FilesTypeMockTypeMock.NETMockWeaver.dll
Target Runtime .NET 2.0
Initialize Profiler 0, Target Runtime .NET 2.0

Code examples:


public void test4()
{
ClassUnderTest t = new ClassUnderTest();
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
ClassToBeMocked.RunStatic(); <<< Exception raised here <<<
}

t.runStatic();
}


public void test1()
{
MockManager.Init();
Mock mock = MockManager.Mock(typeof(ClassToBeMocked));
mock.ExpectCall("RunSimple");

ClassUnderTest classUnderTest = new ClassUnderTest(); <<< Exceptino raised here <<<
classUnderTest.runSimple();

}
asked by RAD (1.8k points)

7 Answers

0 votes
Hi
Please check Properties of TypeMock.dll in the solution explorer.
Is it a valid path?
If not add the TypeMock.dll under TypeMock.NET installation directory.
Note that if your code runs under .NET 1.1 add the TypeMock.dll under
<TypeMock.NET installation directory Net11TypeMock.dll>

Please tell me if it helps.
answered by ohad (35.4k points)
0 votes
Properties show

C:Program FilesTypeMockTypeMock.NETTypeMock.dll

which is correct location.

There is similiar under NET11 but i'm running under 2.0
answered by RAD (1.8k points)
0 votes
Hi
Few questions:
Please check the path:
C:WINDOWSssembly
Do you see the TypeMock assembly there?

Are you using 64 bit operating system?
answered by ohad (35.4k points)
0 votes
Yes, TypeMock is there but no, I am not on 64-bit.

I am not running my simple app with any NUnit or other Unit testing environment, just TypeMock. Is that relevant?
answered by RAD (1.8k points)
0 votes
Hi,

Let's take it offline. I'll send you instructions in a separate mail.
answered by gilz (14.5k points)
0 votes
Your advice to uncheck 'Enable the Visual Studio hosting process' worked! So thanks for that.

(tried email but it came back unknown address)
answered by RAD (1.8k points)
0 votes
Glad to help.:lol:

Here's the solution:

It seems the problem is related to the fact you are running an .exe (in your case a console app).

In order to correct this:

In your project's Properties pages, in the Debug page, the bottom option "Enable the Visual Studio hosting process" is checked by default.

Uncheck it, and run your application again. It should now run correctly.
answered by gilz (14.5k points)
...