Reputation: 4602
I am having some problems after enabling Code Coverage during our TFS builds. The solution under test contain three test projects and out of 209 tests three tests fail (one in one project and two in another), with the following error:
Test method MyNamespace.MyTest threw exception:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Unexpected error returned by SetDetourProvider in profiler library 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\14.0.0\Microsoft.IntelliTrace.Profiler.14.0.0.dll'.
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()
Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()
Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create()
MyNamespace.MyTest () in MyFile.cs: line 224
The stack trace indicates that is connected to the use of Shims. All test pass locally even when running Code Coverage and disabling Code Coverage during build makes the tests pass again. The issue seems slightly related to Microsoft Fakes generates UnitTestIsolationException, but Resharper is not installed on the build servers.
What I have tried:
/p:EnableIntelliTrace=true
and .runsettingDiagnostic="true"
to all .fakes filesMy build server setup:
Upvotes: 1
Views: 2001
Reputation: 19
I struggled with the same error message, though in my case it was when running the tests themselves. When executed from the commandline, vstest.console.exe worked flawlessly, but when run from a Bamboo build task, it failed with the message above.
The problem was ultimately the user running the task - the build server used the SYSTEM user. When I ran the task as a normal privilege user, it succeeded.
Upvotes: 1
Reputation: 31075
According to Feedbacks UnitTestIsolationException when debugging tests using Fakes with IntelliTrace Enabled and Debugging a c# Unit Test with fakes and Intellitrace turned on throws UnitTestIsolationException, Fakes does not work if intellitrace is enabled in test setting.
Upvotes: 0