Build/Test Issues

System.NullReferenceException when running with isolator V7

Started by dhelper on 14,318 views

Test uses NUnit and Isolator V7. Pass when run using Resharper but fails with nCrunch

System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.NullReferenceException : Object reference not set to an instance of an object.
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at gs.c()
at dj.a(Boolean A_0)
at dp.b(Boolean A_0)
at i1.b(Boolean A_0)
at i1.a(Object A_0, Boolean A_1, Func`1 A_2, Action A_3, Action A_4, Action A_5)
at i1.b(Object A_0)
at TypeMock.ArrangeActAssert.ExpectationEngine`1.a(TResult A_0)
at ...
Hi, thanks for sharing this issue.

Are you able to share any code from the test? If you're able to show the test record/expectations this may help highlight the the issue.

Also, can you confirm whether you're running the latest version of Isolator V7? The first release of Isolator V7 had some issues with NCrunch.


Cheers,

Remco
The test fails on a line that looks like this:
[Test, Isolated]
public void MyTest()
{
const string sessionId = "session-1";
Isolate.WhenCalled(() => OperationContext.Current.SessionId).WillReturn(sessionId); // <-- fail here

The code fails before it even reach my class under test
Thanks - that's very useful. Are you able to share which precise version of Isolator you're using? I'll look into the problem here and will try to reproduce it.
I'm tried using 7.0.4but I think it would happen with the latest 7.0.5 as well.
An update on this: I'm currently working with members of the Isolator team to identify why this issue is occurring. Hopefully I'll have more details to share soon.
I've got the same issue, Is there any new data or hack to share?

Edited

Sadly I still haven't heard back from the Isolator team. It's starting to look like NCrunch's support for Isolator may just end with V6.
Solved - Upgrading to Isolatror v. 7.0.9 solved this issue.
Excellent news! Thanks for sharing!

Post a reply

Log in to reply.