Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!

System.InvalidProgramException

0 votes
Hello,

We are using Typemock 6.0.6 with VS 2008 and .Net 3.5.1. Today a bunch of windows updates where pushed out and our build server started failing tests. Here is a simple program to reproduce the issue:

using IronPython.Hosting;
using NUnit.Framework;

namespace ClassLibrary1
{
[TestFixture]
public class Tests
{
[Test]
public void Expression()
{
var e = new PythonEngine();
var res = e.Evaluate("2+2");
Assert.AreEqual(4, res);
}
}
}

We are using IronPython 1.1.2. Note: We are not even using Typemock in the sample test, but the presence of Typemock in the references is enough to cause this error:

Test 'ClassLibrary1.Tests.Expression' failed: System.TypeInitializationException : The type initializer for 'IronPython.Runtime.Operations.Ops' threw an exception.
----> System.InvalidProgramException : Common Language Runtime detected an invalid program.
at IronPython.Runtime.Operations.Ops.MakeList()
at IronPython.Runtime.SystemState.Initialize()
at IronPython.Runtime.SystemState..ctor(EngineOptions options)
at IronPython.Hosting.PythonEngine.Initialize(EngineOptions engineOptions)
at IronPython.Hosting.PythonEngine..ctor()
Tests.cs(12,0): at ClassLibrary1.Tests.Expression()
--InvalidProgramException
at IronPython.Runtime.Types.OpsReflectedType..ctor(String name, Type baseType, Type opsType, Type extensibleType)
at IronPython.Runtime.Types.OpsReflectedType..ctor(String name, Type baseType, Type opsType, Type extensibleType, CallTarget2 optimizedCtor)
at IronPython.Runtime.Operations.StringOps.MakeDynamicType()
at IronPython.Runtime.Operations.Ops.MakeDynamicTypesTable()
at IronPython.Runtime.Operations.Ops..cctor()

Remove the Typemock reference and the test will run fine. I did try upgrading Typemock with the latest version (7.1.7), but I still get the same result.

Any help is much appreciated.

Matt B
asked Jan 10, 2013 by MBeckius (490 points)

18 Answers

0 votes
Hello,

If the machine is installed with the latest windows update than this is probably the reason.
There are some breaking changes to the .net framework that cause the Isolator to fail. We are working to fix it and we'll release the update ASAP.
answered Jan 13, 2013 by NofarC (3,980 points)
0 votes
Is there an estimated ETA for this fix? Will there be a fix for version 6.x?

Thanks,

Matt B.
answered Jan 14, 2013 by MBeckius (490 points)
0 votes
Hi Matt,

We are still working hard on finding a solution; so far we have identified 2 potential problematic updates:

1. http://support.microsoft.com/kb/2742599

2. http://support.microsoft.com/kb/2750149

We can't say for certain that these two are it, or that these are the only 2 updates that caused the problem (there might be more).
Regarding to version 6.X, I'll need to check and get back to you.

I will keep you posted.
answered Jan 14, 2013 by NofarC (3,980 points)
+3 votes
Hi,
We are experiencing a similar problem - using Ironpython v2.6.1008.2 and Typemock v6.2.5.0

The failure seems to occur when Python.CreateEngine(); is called.

Here is an example of the error I am getting in one of the approx 4000+ tests now failing after the last batch of windows updates.

System.InvalidProgramException was caught
Message=Common Language Runtime detected an invalid program.
Source=Microsoft.Scripting
StackTrace:
at Microsoft.Scripting.Hosting.ScriptRuntime..ctor(ScriptRuntimeSetup setup)
at IronPython.Hosting.Python.CreateRuntime()
at IronPython.Hosting.Python.CreateEngine()
at MyClass.get_Engine() in MyClass.cs:line 26
at MyClass.ExecuteScriptTwoParameters(String script, Object parameter1, String parameter1Name, Object parameter2, String parameter2Name) in MyClass.cs:line 86
at MyClass.ExecuteScript[TDataType](String script, Object parameter1, String parameter1Name, Object parameter2, String parameter2Name) in MyClass.cs:line 61
at ASM.Sequoia.Common.Test.ScriptHelperTest.ScriptHelperShouldThrowExceptionWhenExpressionReturnsTheWrongDataType() in MyClassTest.cs:line 109
InnerException:


What I will say is that I have tried to create a new test project without referencing typemock, and I get the same exception - so I am not sure that it is down to the reference. I do not have access to a dev machine without typemock installed, so maybe my analysis is wrong.

my test is:

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace IronPythonTestProject
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
try
{
//NO usings/references to typemock in this test project
ScriptEngine engine = Python.CreateEngine();
}
catch (Exception ex)
{
Assert.Fail(ex.ToString());
}
}
}
}


If anyone has any further info - that would be really helpful!

Thanks,
Jason
answered Jan 17, 2013 by JasonJhuboo (650 points)
+1 vote
Hi Justin,

It looks like the same problem. Once we'll have a patch will get back to you.
I'm sorry for the inconvenience.

Gil
answered Jan 17, 2013 by gilz (20,200 points)
+1 vote
Hi,

We've been working hard to make this patch, and we want to thank you for your patience. While it's not complete yet, and requires more testing, we decided to release it, so you can get to normal work as soon as possible.
You can download the patch from here: https://www.typemock.com/files/TypemockI ... e7.2.0.msi
Please note that it may require uninstalling the current installed version of Isolator.

We will soon release a full upgrade, after we complete our testing.
We'd like to know if this solves your issues. If you still experience problems, let us know immediately, so we can make the necessary fixes.

Thanks,

Gil Zilberfeld
Product Manager, Typemock
answered Jan 20, 2013 by gilz (20,200 points)
0 votes
After using 7.2 the error is no longer occurring. However, I am getting a bunch of:

"*** Faking non-virtual methods is not possible in InterfaceOnly design mode. Use [Isolated(DesignMode.Pragmatic)] to fake this."


I am not sure if this is related to the fact that we were only licensed for 6.x. I did get a warning when starting VS that our support had expired and only basic features were available (or something to that affect).

Please advise.

Thanks,

Matt B
answered Jan 21, 2013 by MBeckius (490 points)
+3 votes
Hi Gil,
Please can you advise if you are going to be fixing this in v6? We have not upgraded to version 7 previously as upgrading decreased the speed of our tests runs dramatically (I have contacted your company in the past about this – we spent a great deal of time (and time equates to money!) trying to upgrade; due to both speed / test compatibility problems we stayed with v6.2.5).

Regards,
Jason
answered Jan 21, 2013 by JasonJhuboo (650 points)
+1 vote
Hi Jason,

We're not sure yet :)
We're currently working on a new patch that we're hoping will have some kind of backward compatibility. We'll keep you posted.

In the mean time - I'd like to know which version you used when upgrading, and how much decrease in performance you saw. We're considering some performance improvements, and this information can help us.

Thanks in advance,
Gil
answered Jan 23, 2013 by gilz (20,200 points)
0 votes
I have the same problems after installing security update KB2742595. Some unittests in Visual Studio 2010 fail with the same error. It is fixed with the 7.2 patch mentioned in the previous post.

Is it save to use the 7.2 patch in the previous post for our production environment? We support a lot of developers that rely on Typemock.

What is the status of the official 7.2 release? When is it released?
answered Feb 1, 2013 by Jesse (260 points)
...