chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
We are using Isolator 6.0.4.0, and are also early adopting ASP.NET MVC3 with razor views.

If we have Isolator installed, trying to consstruct a controller in the test project throw a System.Security.VerificationException: Operation could destabilize the runtime.

If we uninstall Isolator, everything works.

Do we need to wait for an update to Isolator before we can run any unit tests?

Any help would be appreciated.
asked by ChadYost (680 points)

16 Answers

0 votes
Hi,

Thanks for submitting the issue.
We'll try to reproduce the error and fix it.
answered by ohad (35.4k points)
0 votes
same here
answered by tolisss (28.8k points)
0 votes
I'm also seeing this issue and the patch doesn't fix it. I'm guessing the patch not fixing it has something to do with my having VS2010 SP1 installed. A colleague of mine has no SP1 installed and can get the tests to pass using the .355 patch provided above.

SUPER simple repro:

File -> New ASP.NET MVC3 Project.
Make it an empty project.
Add a reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework.
Add references to Typemock.dll and Typemock.ArrangeActAssert.dll.
Drop the following test fixture in and try to run the test:

using System;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TypeMock.ArrangeActAssert;

namespace MvcApplication1.Controllers
{
   [TestClass]
   [Isolated]
   public class DemoTestClass
   {
      [TestMethod]
      public void Test()
      {
         var controller = Isolate.Fake.Instance<Controller>();
         var context = Isolate.Fake.Instance<ControllerContext>();
         Isolate.WhenCalled(() => controller.ControllerContext).WillReturn(context);
         var actual = controller.ControllerContext;
         Assert.AreSame(actual, context);
      }
   }
}


The test fails with the exception:
Test 'MvcApplication1.Controllers.DemoTestClass.Test' failed: TypeMock.TypeMockException: 
*** No method calls found in recording block. Please check:
 * Are you trying to fake a field instead of a property?
 * Are you are trying to fake an unsupported mscorlib type? See supported types here: https://www.typemock.com/mscorlib-types
   at gj.a(cs A_0, Boolean A_1)
   at dg.a(Boolean A_0)
   at dl.b(Boolean A_0)
   at in.c(Boolean A_0)
   at in.a(Object A_0, Boolean A_1, Func`1 A_2, Action A_3, Action A_4, Action A_5)
   at in.c(Object A_0)
   ControllersDemoTestClass.cs(20,0): at MvcApplication1.Controllers.DemoTestClass.Test()
   at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Boolean A_5, Object[] A_6)
   at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType)
   ControllersDemoTestClass.cs(0,0): at MvcApplication1.Controllers.DemoTestClass.Test()


Tried this with version 6.0.7.0 and was equally unsuccessful.

Also getting VerificationException on some tests, but I don't have a repro for that.

HELP!
answered by tillig (6.7k points)
0 votes
I am having the same problems since upgrading from 6.0.4 to 6.0.7. The only difference is that I'm using MVC2 in my case. There seems to be problem with Faking the ControllerContext class.
answered by Maxime.Soucy (220 points)
0 votes
I received a workable patch (6.0.7.473) from support that fixed the issue for me under VS2010 SP1 and MVC3. Hopefully this will be released to the public soon.
answered by tillig (6.7k points)
0 votes
This fix is included in release 6.0.8.
answered by RonRatz (3k points)
...