Search code examples
c#visual-studio-2012microsoft-fakes

Microsoft Fakes generates UnitTestIsolationException


I have written very simple unit test project to see abilities of Microsoft Fakes. And I have executed on System assembly the menu command "Add Fakes 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 in line using (ShimContext.Create()) I get always the UnitTestIsolationException:

Unexpected error returned by SetDetourProvider in 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'.

With my Visual Studio 2012 Update 2 is also installed Resharper. How fix this exception?


Solution

  • As of November 2012 you cannot run Resharper and MS Fakes at the same time. A request to make it compatible was put in almost a year ago.

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