Build/Test Issues

System.InvalidProgramException: Common Language Runtime detected an invalid program

Started by ylee on 31,766 views

NCrunch 1.38.0.17b,
Visual Studio 2010
Windows 7 64bit

Steps to reproduce the issue (VS 11 beta + NCrunch 1.38.0.18b don't have this issue):

1. Open VS 2010;
2. File > New > Project, choose Installed Templates > Visual C# > Test Project, to create a new test project;
3. NCrunch > Enable NCrunch, use default settings in the Configuration Wizard;
4. NCrunch > Tests, I get the following exception in the NCrunch Tests window:

System.InvalidProgramException: Common Language Runtime detected an invalid program.

Server stack trace:
at System.Uri.ParseScheme(String uriString, Flags& flags, UriParser& syntax)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at nCrunch.Common.AppDomainHelper.GetLocationOnDisk(Assembly assembly)
at nCrunch.TestExecution.Frameworks.NUnit.NUnitTestFramework.GetDescription()
at nCrunch.TestExecution.Frameworks.TestFrameworkRegistry.GetDescriptionForEachFramework()
at nCrunch.TestExecution.Frameworks.FrameworkDescriptionResolver.GetDescriptionForEachFramework()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at nCrunch.TestExecution.Frameworks.IFrameworkDescriptionResolver.GetDescriptionForEachFramework()
at nCrunch.Core.TestManagement.TestFrameworkDescriptionManager.EnsureDescriptionsAreLoaded()
at nCrunch.Core.ComponentLoader.SnapshotComponentFactory.CreateSnapshotComponentFromXml(String projectFilePath, String projectXml, String solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile)

Hi,

Thanks for reporting this. I'm wondering if this could be related to the other issue you've reported on this forum. Do you have a 64-bit version of NUnit installed in your GAC?
Remco wrote:Do you have a 64-bit version of NUnit installed in your GAC?

Yes. I've just uninstalled NUnit from GAC, but I still got the same errors.

Update: I reinstalled NCrunch after removing NUnit from GAC, but still got the same errors.

Edited

Ok - can you check the following?

- That you don't also have a 64 bit version of NUnit.Core in your GAC (consider running the NUnit uninstaller)
- That you don't have any references to NUnit.Core throughout your codebase (often people set these up by accident mistaking NUnit.Core for NUnit.Framework)
- That the version of NUnit.Framework referenced from all projects in your solution has not be compiled specifically for 64-bit. If you want to be certain of this, try grabbing the NUnit.Framework.dll file from "Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2010" and using this as your NUnit reference.
- That you don't also have a 64 bit version of NUnit.Core in your GAC (consider running the NUnit uninstaller)

Yes. I uninstalled NUnit using its uninstaller. I checked C:\Windows\assembly, there is no NUnit assemblies there.

- That you don't have any references to NUnit.Core throughout your codebase (often people set these up by accident mistaking NUnit.Core for NUnit.Framework)
- That the version of NUnit.Framework referenced from all projects in your solution has not be compiled specifically for 64-bit. If you want to be certain of this, try grabbing the NUnit.Framework.dll file from "Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2010" and using this as your NUnit reference.

The test solution don't have any reference to NUnit, it has only references to:
* Microsoft.VisualStudio.QualityTools.UnitTestFramework
* System
* System.Core

But I still got the same errors.

Edited

Are there many situations where you've managed to get past this problem? I'm thinking in reference to the other thread on this forum where you've mentioned this same exception bubbling up from the test runner itself.

Also - which version of TypeMock Isolator are you using?

Edited

Remco wrote:Are there many situations where you've managed to get past this problem? I'm thinking in reference to the other thread on this forum where you've mentioned this same exception bubbling up from the test runner itself.

Also - which version of TypeMock Isolator are you using?

I'm using Typemock Isolator 6.2.

The issue in this thread only happens in VS 2010, VS 11 beta doesn't have this issue (I've posted my system configurations in my first post).

I'm trying to find workaround to this issue, but so far no luck.

Edited

OK, to fixed the issue in this thread, I only need to disable Typemock, then re-enabled it in VS 2010 (I only need to do this once, and it fixed all solutions).

And the issue in the other thread can be workaround by removing references to Typemock assemblies.

So both issues are related to Typemock Isolator.

Edited

Ok thanks - I'll raise the issue with the TypeMock guys to see if we can work out a proper solution.
Since, I have installed vs11 , I am unable to run my tests. I have the following exception :

System.InvalidProgramException: Common Language Runtime detected an invalid program.

Server stack trace:
at System.Uri.ParseScheme(String uriString, Flags& flags, UriParser& syntax)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at nCrunch.Common.AppDomainHelper.GetLocationOnDisk(Assembly assembly)
at nCrunch.TestExecution.Frameworks.NUnit.NUnitTestFramework.GetDescription()
at nCrunch.TestExecution.Frameworks.TestFrameworkRegistry.GetDescriptionForEachFramework()
at nCrunch.TestExecution.Frameworks.FrameworkDescriptionResolver.GetDescriptionForEachFramework()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

I disabled and reenabled it from vs2010 but without any success.

Thanks - I'm coordinating with the TypeMock team at the moment to find a proper solution to the above issue. I'll keep you informed.
I also opened a case 3389. thanks
I've had a response from TypeMock support. It seems like this was an NCrunch/Isolator integration issue that surfaced with the release of Isolator 7. A fix has been implemented in the latest revision of Isolator 7, so hopefully updating your version of Isolator will solve this problem. Please let me know how this goes!

Cheers,

Remco
Hello Remco,

I upgraded to Typemock 7 but with no success. :-(

Best regards,
I've upgraded to Isolator v7, but also no success.

I got slightly different errors in the Processing Queue:

[08:28:16.079-TestExecutionTask-100] ERROR (Internal): System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Uri.NotAny(Flags flags)
at System.Uri.PrivateParseMinimal()
at System.Uri.InitializeUri(ParsingError err, UriKind uriKind, UriFormatException& e)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at NUnit.Core.AssemblyHelper.GetAssemblyPath(Assembly assembly)
at NUnit.Core.AssemblyHelper.GetDirectoryName(Assembly assembly)
at NUnit.Core.TestFixture.Run(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
at NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter)
at nCrunch.TestExecution.Frameworks.NUnit.NUnitTestFramework.#=qiRaO95hMU_NKiz9fhSn1tZiGseNaUPKscSzJwth8ThI=.#=qVl6GJZE$6kQEYsal_I6mkA==()
at #=qV4IY3Yw5t4EgaYNhxDl$mQCLZnuJSlEmqrATHMaf9kuVN$GE5NX224lFVpTAvNkQ.#=q$6XPpuVURa0ezT6uQzqgDwmM9wPuWSG4j0sPkq0XzSM=(Action #=qCQqo10P9uAVt1mjisBx_vzZH4DIuv1TwklAer7L4qog=)
at nCrunch.TestExecution.Frameworks.NUnit.NUnitTestFramework.RunTests(TestOutput output, IList`1 testsToRun, MasterExecutionMapSet masterMapSet, Boolean considerInconclusiveTestsAsPassing)
at nCrunch.TestExecution.TestRunnerThread.#=qrunPHTClepwZQbgbb46aOA==(IMasterExecutionMap[] #=q6lwWDhlwcyIoeH1qADH271XREPxtA9PvlShczv8M39E=, IList`1 #=qKY93wGIDiTfNlLEKDFnuhg==, Boolean #=qWtjeCDb5$CN5QWbxqDrGiavS4BNJFchDz5s1sqYaKn6fvmPwLoe9Wj4C$wzzLLOb)

Thanks - this looks like a similar issue. I'll let the TypeMock guys know about it.
Thanks to Typemock support , the issue is solved:

This is a major issue that is not reproduced on every machine.
This is a high priority in our list and we working to find the correct fix.
One thing that we found is that it happens on machines where both VS2010 and VS2011 beta are installed.
Is this that case on your machine?

As a temporary workaround you can open the file blacklist.dat in Isolator installation directory and add the line:
System
This will probably solve the problem but will prevent you from faking anything in System namespace.

Hope that helps

Atali
atali wrote:Thanks to Typemock support , the issue is solved:

This is a major issue that is not reproduced on every machine.
This is a high priority in our list and we working to find the correct fix.
One thing that we found is that it happens on machines where both VS2010 and VS2011 beta are installed.
Is this that case on your machine?

As a temporary workaround you can open the file blacklist.dat in Isolator installation directory and add the line:
System
This will probably solve the problem but will prevent you from faking anything in System namespace.

Hope that helps

Atali

Thanks, the workaround works!
I've also had an update from TypeMock informing me that they are treating this as a priority 1 issue, so I'm sure a proper fix will be released for it soon.

Cheers,

Remco
I've just tonight heard from TypeMock that they have a new version out with a fix for the above. Hopefully this will solve the issue!

Cheers,

Remco


Post a reply

Log in to reply.