Tests with MS Fakes cause IntelliTrace.Profiler exception after update to 2019.2


After updating TeamCity server from 2019.1.5 (b 66605) to 2019.2 (b 71499) I started getting following exceptions when running a suite of unit tests:

Initialization method UnitTests.xxx.RunOnceBeforeEachTest threw exception. Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Unexpected error returned by SetDetourProvider in profiler library 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\Microsoft.IntelliTrace.Profiler.dll'..
[11:16:14] : [Step 3/3] Stack Trace:
[11:16:14] : [Step 3/3] at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()
[11:16:14] : [Step 3/3] at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()
[11:16:14] : [Step 3/3] at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()
[11:16:14] : [Step 3/3] at UnitTests.TestBase.RunOnceBeforeEachTest() in C:\TeamCity\buildAgent\work\xxx\TestBase.cs:line 42

With TeamCity 2019.1.5 this worked fine. Now all tests that use MS Fakes fail at ShimsContext.Create(). Other tests run fine. When I run tests from console or VS2017 (on the agent machine) - everything works fine. Is it a bug in TC 2019.2?


Comment actions Permalink

Hi Andrzej,


Thanks for your report, may I ask you to check which version your local VS 2017 is as well? I've not found any other report for this specific issue in any of our channels, but I have found some reports of this issue in internet not related to teamcity:



According to this thread, it was fixed in a later release of VS 2017, so depending on the version installed on the agent, o rmaybe the tooling we use to pull from them, but it might be because of a lack of disk space during that specific point in time. Could you double check any of those help? Otherwise, it might actually be a bug that hasn't been reported before, so if there doesn't seem to be space issues during the build, I'd like to ask you to open an issue in our issue tracker: https://youtrack.jetbrains.com/issues/TW . Please provide the full build log (feel free to set its visibility only to jetbrains-team and yourself) so that we can understand the full context of the process

Comment actions Permalink

Hi Denis,

Thanks for response. The VS version is 15.9.19 (Enterprise). I saw that thread before, but the build agent has 200+ GB of free space. I don't think disk space is the problem. I will double check and probably open an issue. One more thing: I upgraded to 2019.2.1 yesterday and the problem is still there.

Comment actions Permalink

Hi again, I have created a new issue nr 64599.

Comment actions Permalink

For reference of anybody seeing this, it's being handled here: https://youtrack.jetbrains.com/issue/TW-64599


Please sign in to leave a comment.