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

Notification

Icon
Error

NullReferenceException building test project
maddax
#1 Posted : Monday, September 26, 2011 10:01:29 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/26/2011(UTC)
Posts: 2
Location: Cambridge, UK

Was thanked: 1 time(s) in 1 post(s)
Hi,

I'm trying out NCrunch for the first time. The video looks really promising.

I get the following error when building the project via NCrunch. Building it directly works fine.

(0): System.NullReferenceException: Object reference not set to an instance of an object.
at Mono.Cecil.Cil.CodeReader.MoveTo(Int32 rva)
at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
at Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.MethodDefinition.get_Body()
at nCrunch.Compiler.ILManipulator.#=qrtjCCeJ8cpgmrVjTjltwcwMwgcoYjxiDAfwLCobhvwg=(Collection`1 #=qePAxKcGbEvsoD6JG4hmGtQ==)
at nCrunch.Compiler.ILManipulator.#=qv714_ylBCYqkXTaep6p6996llk6MzHyNcFcHcBU3iJc=(IEnumerable`1 #=qn$mhNmyKMrpUUahZ$GCRqw==)
at nCrunch.Compiler.ILManipulator.ProcessAssembly(String compiledAssemblyFilePath, Boolean instrumentAssembly, IList`1 referencedAssemblies)
at nCrunch.Compiler.RemoteBuildRunner.#=q0uoBxrNlTkjmTSaxJhYlkQrKe_8WNPmit72NeowJC3s=(ComponentBuildParameters #=qCn0HgHIPPJdr$MwJ5iYsMw==, String #=qb05IZ2bLgQYgLTiHuoQfWea6UIyV9UtiGonMsT$9U6A=, BuildOutput #=qCM8XL7dpUexUEnvWKXQW7g==, String #=qrkYYOthLpeqZ$SKMUKGPIZHg$j4NbswsFmroxjnM2dQ=)
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)

Any ideas? I'm using NCrunch for Visual Studio 2010 1.34.0.0b. It's an NUnit test project.

Thanks,
Matthew
Remco
#2 Posted : Monday, September 26, 2011 12:15:20 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
This is a problem caused by instrumentation. Most likely your assembly has a certain IL arrangement that isn't supported by NCrunch. Try turning off instrumentation on this project to see if that makes a difference. If there's any way for me to have a copy of the assembly (.dll) that's causing this, I'd really like to have a look at the IL inside it - though I understand this may not always be possible if you are working on a commercial project.
maddax
#3 Posted : Friday, September 30, 2011 2:00:29 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/26/2011(UTC)
Posts: 2
Location: Cambridge, UK

Was thanked: 1 time(s) in 1 post(s)
Thanks for the quick response. Unfortunately, this is a commercial project so I can't send the code. I've tried (unsuccessfully) recreating it in a dummy project.

I also noticed that there doesn't yet seem to be support for NUnit test attributes (Values(...), ValueSource(...) etc.), which is something we make heavy use of, so I'll probably put the trial on hold for now (or maybe start using NCrunch with personal projects).

Kind regards,
Matthew
1 user thanked maddax for this useful post.
Remco on 9/30/2011(UTC)
Remco
#4 Posted : Monday, October 10, 2011 6:09:20 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
For anyone experiencing the above issue - I've had a look at this in detail and unfortunately it isn't an easy one to fix.

One common cause of the issue stems from the use of COM interfaces in assemblies that NCrunch is attempting to instrument. If you are unlucky enough to have this problem, the best I can recommend at the moment is switching off instrumentation for the offending assembly.

Meanwhile please be advised that I'm working on a fix for this issue as part of a longer term plan.
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.035 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download