Daily Usage Issues

NCrunch v2 BETA 2.3.0.15 - Cannot execute test with MS Fakes.

Started by MrClyfar on 7,731 views

Hiya.

I have a VS2013 project containing XUnit tests with MS Fakes. Here is an example test:

[Fact]
public void Test()
{
var p = new Person();

using (ShimsContext.Create())
{
// Arrange.
const int anyAge = 23;

Tests.Unit.Fakes.ShimPerson.AllInstances.GetAgeFromDatabase = (instance) => anyAge;

var sut = new Bank();

// Act.
int age = sut.Foo();

age.Should().Be(anyAge);
}
}


NCrunch cannot execute the above test. The following error comes up:

Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException : Failed to open profiler registry key 'CLSID\{b19f184a-cc62-4137-9a6f-af0f91730165}\InprocServer32'.

My Visual Studio details are:

Microsoft Visual Studio Premium 2013
Version 12.0.30110.00 Update 1

Thanks.

Edited

Hi, thanks for sharing this issue.

Probably a stupid question - but can you confirm that MS Fakes runs correctly on your machine outside of NCrunch? (i.e. using the VS test runner)

If so, I'm wondering if you can try the following:

- Set a breakpoint on the first line of your test
- Run the test using the VS test runner so it hits the breakpoint
- Open the Immediate debugging window
- Enter in: System.Environment.GetEnvironmentVariable("COR_PROFILER")

.. What is the result that this statement gives you?


Thanks!

Remco
Sorry - I've just done some more testing on this. It looks like the problem is being caused by changes in the profiler's CLSID. I'll need to fix this in the next beta build. Thanks for taking the time to report this issue.
Hiya.

Sorry I couldn't reply sooner, been away for most of the day.

Bit late, but just to confirm, yeah I'm able to run the tests without NCrunch installed; via the MS Test runner.

Cheers.
Jason.

Post a reply

Log in to reply.