Microsoft Fakes throws UnitTestIsolationException

I wrote a very simple unit test project to see the features of Microsoft Fake. And I ran the Add Fakes Assembly menu command on the system assembly.

public static class Y2KChecker { public static void Check() { if (DateTime.Now == new DateTime(2000, 1, 1)) throw new ApplicationException("y2kbug!"); } } [TestClass] public class UnitTest1 { [TestMethod] public void TestYear() { using (ShimsContext.Create()) { ShimDateTime.NowGet = () => new DateTime(2000, 1, 1); Y2KChecker.Check(); } } } 

But when using the string (ShimContext.Create ()), a UnitTestIsolationException always occurs:

Unexpected error returned by SetDetourProvider in the profiler library 'C: \ Program Files \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ IntelliTrace \ 11.0.0 \ Microsoft.IntelliTrace.Profiler.11.0.0.dll'.

In my version of Visual Studio 2012 Update 2, Resharper is also installed. How to fix this exception?

+6
source share
5 answers

As of November 2012, you cannot run Resharper and MS Fakes at the same time. The requirement to make it compatible was made almost a year ago.

http://devnet.jetbrains.com/message/5470396?tstart=0

+3
source

Currently (March 2014), you can run tests that use MS Fakes only in the Visual Studio Test Runner (vstest.console.exe). Of course, you can continue to use ReSharper, but its test runners will not be able to run your tests.

+1
source

I have the same problem when working with VS2012 + ReSharper, I switched to VS2013 without ReSharper, and it worked fine.

I returned to VS2012 and tried to pause ReSharper , but this did not solve the problem.

+1
source

In my case, the problem only occurs in TeamCity.

I decided to switch from MSTest to VSTest .

0
source

As of October 2017, I was able to run tests through Resharper, but not when collecting code coverage

0
source

All Articles