ShimsContext.Create is throwing a StackOverflowException

I get a StackOverflowException on ShimsContext.Create when running my unit test. In the code below, I can break on Thread.Sleep(0), so I know ShimsContext.Create is raising the exception. I have commented everything else out. Any idea why this happens or how to fix it?

    [TestMethod]
    public void MyTest()
    {
        Thread.Sleep(0);
        using (ShimsContext.Create())
        {
            //commented out test logic that needs shims
        }
    }

Overflowed stack looks like:

Microsoft.QualityTools.Testing.Fakes.dll!Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.TraceProfilerInstrumentationProvider.ProtectingContext.ProtectingContext() + 0x1f bytes 
Microsoft.QualityTools.Testing.Fakes.dll!Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.TraceProfilerInstrumentationProvider.AcquireProtectingContext() + 0x2d bytes    
Microsoft.QualityTools.Testing.Fakes.dll!Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.TraceProfilerInstrumentationProvider.DetourProvider(object receiver, System.RuntimeMethodHandle methodHandle, System.RuntimeTypeHandle declaringTypeHandle, System.RuntimeTypeHandle[] 

These 3 calls repeat infinitely.

链接地址: http://www.djcxy.com/p/80766.html

上一篇: StackOverflowExceptions在堆栈展开时的嵌套异步方法中

下一篇: ShimsContext.Create抛出StackOverflowException