Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch v2 BETA 2.3.0.15 - Cannot execute test with MS Fakes.
MrClyfar
#1 Posted : Saturday, January 25, 2014 11:36:50 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/6/2011(UTC)
Posts: 17

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
Hiya.

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

Quote:
[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.
Remco
#2 Posted : Sunday, January 26, 2014 12:53:37 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,983

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
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
Remco
#3 Posted : Sunday, January 26, 2014 1:04:55 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,983

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
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.
MrClyfar
#4 Posted : Sunday, January 26, 2014 8:34:06 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/6/2011(UTC)
Posts: 17

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
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.
1 user thanked MrClyfar for this useful post.
Remco on 1/26/2014(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.033 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download