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 Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I have a project that uses the NUnit framework (v2.6.3) to define several unit tests and uses TypeMock Isolator to create fake objects. When I run these tests from the TypeMock shield icon next to the test, they run fine. When I run the tests using dotCover's "Cover Unit Test with dotCover" menu item, they run fine. However, when I try to run them with dotCover's "Run Unit Tests" or "Debug Unit Tests" menu items, they fail with this error:

Test method UnitTests.UnitTests.TestMethod1 threw exception:
TypeMock.TypeMockException:
*** Typemock Isolator is currently disabled. Enable using the following:
...

Callstack:
at TypeMock.InterceptorsWrapper.VerifyInterceptorsIsLoaded()
at ga.e()
at TypeMock.MockManager.Init(Boolean collectAllCalls)
at gl.CreateFakeInstance

Tests that don't use Isolator run fine with this method. Only those that use Isolator fail.

After decompiling and debugging the TypeMock assemblies, it looks like the reason is twofold:
1) The TMOCK_RUNNING_VERSION environment variable is "7.5.1.0" when running from the Smart-Runner (TypeMock runner), but is null when running under dotCover.
2) The TMOCK_PID environment variable is set to the PID when running normally, but is null when running under dotCover.

If I set these values manually while debugging the tests, the tests run fine. So for some reason, these environment variables are not getting set with that run/debug method. On the other hand, apparently nobody cares except for the TypeMock validation code which throws these exceptions. The TypeMock.Interceptors dll is loaded and works fine, the test runs fine.

The problem also occurs when running test that use the MSTest framework and when using Visual Studio's runner (Test->Run menu item). So this appears to be an issue in TypeMock itself.

Here's my setup:
Windows 7 Professional
Visual Studio 2010 (Identical results with VS 2012)
TypeMock v7.5.1.0 "Essential" Edition (Installed on local machine, *not* using AutoDeploy)
NUnit v2.6.3
dotCover v2.6.608.466

I've played with just about every setting there is. Results are identical. A short list is:
Enabling/disabling "Enable mocking for 3rd party runners". (no difference)
Manually linking using the TypeMock Isolator configuration tool. (no difference)
Enabling/disabling "Disable auto linking" in configuration tool. (no difference)
Banging my head repeatedly on my keyboard. (head hurt afterwords, no difference in test results)

Anyone have any ideas here? I've seen lots and lots of similar questions, but no answers that work for me.

Thanks,
Kevin
asked by Kevin (3.2k points)

6 Answers

0 votes
Hi Kevin,

In order to fix this issue please add JetBrains.PsiFeatures.dotCover.TaskRunner.CLR4.x64.exe to namespaces.dat located under Isolator installation folder.

The fix will be included in the next Isolator release.
Let me know if it helps.
answered by alex (18k points)
0 votes
Hey Alex, thanks for taking the time to help out!

Unfortunately, this didn't fix the issue for me. I tried adding several other of the dotCover TaskRunner exes to that namespaces file as well, but no luck.

Not sure if it makes a difference, but I have upgraded to dotCover 2.7.0.662 since I last posted.

If there's anything I can provide to help make resolving this easier, please let me know. I'm gated on upgrading our TypeMock version because of this issue.

Thanks again!
answered by Kevin (3.2k points)
0 votes
Another data point here:

If I install ReSharper, then uninstall and reinstall TypeMock, the tests run fine though the dotCover interface.

I can use this as a work around for now, but I'd prefer not to add a dependency on ReSharper for our team. So I'm still interested if you have any tips about how to fix this.

Thanks again,
Kevin
answered by Kevin (3.2k points)
0 votes
Hi Kevin,

Thank you for the info.

The runner process depends on the configuration of the project\solution.
Which .Net version do you use?
Is it x86 or x64?

I tried adding several other of the dotCover TaskRunner exe

Did you try to find the name of the process with process explorer?
answered by alex (18k points)
0 votes
>Did you try to find the name of the process with process explorer?

Ah, that would have been clever, so.. umm.. no. ;-)

Doing so, it looks like the process is "JetBrains.PsiFeatures.dotCover.TaskRunner.CLR4.MSIL.exe" (32 bit process)

Adding *that* line to the namespaces.dat file gets me working. Woohoo!

Thanks much Alex, issue solved!
answered by Kevin (3.2k points)
0 votes
Great :D , I'll add JetBrains.PsiFeatures.dotCover.TaskRunner.CLR4.MSIL.exe to our next version as well.
Thank you for the feedback.
answered by alex (18k points)
...