Build/Test Issues

error CS0103: the name '' does not exist in the current context

Started by JamesGrafton on 6,595 views

I'm running ncrunch on a set of tests using xunit, with .Net framework 4.6.1 and nCrunch version 2.22.0.1

When I debug, if I add a watch to a variable I get an error in the format "error CS0103: the name '<variable>' does not exist in the current context"

If I run the test with VS/Resharper test runner it works fine.

Edited

Thanks for sharing this issue.

When NCrunch manipulates the assembly built from your project, it needs to reconstruct the assembly's PDB file. Because MS are constantly updating the compiler and adding new debug metadata, NCrunch is sometimes left behind without knowledge of new metadata elements that have been added. It's possible that you've managed to find one of these.

To solve this problem, I'll need a code sample that can reproduce it. Are you able to whittle this down to a project you can share with me through the contact form?
Unfortunately I can't as it's another company's source code.

Is there a way for me to find out what's missing?

Thanks,

James
Hi James,

No easy way unfortunately, but usually the structure of debug metadata is defined by the method it's in. For example, methods using yield or async tend to require special handling for their metadata. Copy/pasting the method into an empty solution and knocking out much of its source code may be a way to reproduce it. Make sure you have the same compile settings (i.e. same target framework, etc).

Post a reply

Log in to reply.