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

Notification

Icon
Error

System.InvalidProgramException : Common Language Runtime detected an invalid program.
mking
#1 Posted : Monday, January 14, 2013 5:24:03 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/14/2013(UTC)
Posts: 4
Location: Australia

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)
Hello,

I am having a strange issue with NCrunch.

[edit: removed image link - problem description is still present in the 'steps to replicate' section]

Steps to replicate


1. In Visual Studio 2012, create a new Class Library project targeting .NET 2.0
2. Install NUnit via NuGet (Install-Package NUnit).
3. Insert the following code:

public class Example<T>
{
public Example() { }
}

[TestFixture]
public class ExampleTests
{
[Test]
public void ExampleTest()
{
var example = new Example<int>();
}
}

4. Note the following error:
System.InvalidProgramException : Common Language Runtime detected an invalid program.

Additional information


Running VS2012 (Update 1) with NCrunch 1.42.0.12
The issue only appears when targeting .NET framework versions 2.0 and 3.5. Versoions 3.0, 4.0, and 4.5 do not have any issues.
The test passes when using the NUnit test runner, and the VS2012 NUnit test adapter.
Other info: 64bit Windows 7. NUnit v2.6.2. No NUnit dlls in the GAC. VS2010 also installed.






Any suggestions as to why this may be happening, or how to work around it?

Thanks!
Remco
#2 Posted : Monday, January 14, 2013 5:32:32 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi,

This is a result of windows update KB2742616 which changes the behaviour of the JIT while processing .NET 2.0-3.5 assemblies. The change introduces a functional constraint that clashes with the way that NCrunch instruments for performance analysis.

You can work around the issue in one of the following ways:
1. Upgrade to NCrunch 1.44, which was released a few hours ago to specifically address this issue
2. Uninstall the windows update (may require system restore, and probably not the best idea unless it was installed very recently)
3. Update the project(s) in question to use .NET 4.0, which doesn't seem to be affected by this change
4. Turn off the 'Analyse line execution times' for ALL the projects in your solution

More information is available at http://blog.ncrunch.net/post/Windows-Update-KB2742616.aspx


Cheers,

Remco
1 user thanked Remco for this useful post.
mking on 1/14/2013(UTC)
mking
#3 Posted : Monday, January 14, 2013 5:40:39 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/14/2013(UTC)
Posts: 4
Location: Australia

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)
Thankyou for the impressively prompt response, Remco!

This has completely resolved my issue.
1 user thanked mking for this useful post.
Remco on 1/14/2013(UTC)
DanHil
#4 Posted : Friday, June 14, 2013 11:05:41 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/12/2012(UTC)
Posts: 85

Thanks: 11 times
Was thanked: 3 time(s) in 3 post(s)
I am seeing this problem with a .NET 4 project that uses MSTest. NCrunch version is 1.45.0.12.
Turning off 'Analyse line execution times' solves the problem.

I have no problem with my xUnit.net projects.
Remco
#5 Posted : Friday, June 14, 2013 12:13:28 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Daniel -

This is concerning. I hope there isn't a new update that also does this for .NET 4 ... is there a particular piece of code that seems to surface the problem for you? The .NET 3.5 issue described above was triggered by NCrunch instrumenting the constructors of generic types. Is there anything you can enable/disable in the codebase that allows you to reproduce the issue at will?
DanHil
#6 Posted : Friday, June 14, 2013 12:20:49 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/12/2012(UTC)
Posts: 85

Thanks: 11 times
Was thanked: 3 time(s) in 3 post(s)
To be honest, I haven't really invested a lot of time to investigate it.
However, on the code base I experienced it, all 1000 tests failed.

But there are good news: The code base is open source, so you can try to reproduce it yourself:

https://simpleinjector.c...com/SourceControl/latest
Remco
#7 Posted : Saturday, June 15, 2013 2:09:30 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Fantastic, thank you!! I'll see if I can track it down.
Remco
#8 Posted : Thursday, July 4, 2013 6:09:51 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
It looks as though this is the same issue as described in this thread: http://forum.ncrunch.net/yaf_postst898_AnalysisTask-ERROR.aspx.

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.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download