Daily Usage Issues

Debuging a test - watch issue

Started by JamesGrafton on 3,676 views

Hello, I've got a .Net 4.6.1 project that's not doing anything special.

I'm using Moq 4.7.142 and xUnit 2.3.1.

No matter how I debug the test, when I hit a breakpoint, i'm not able to view the value of a variable.

When I add a watch, I get: "error CS0103: The name 'mappedData' does not exist in the current context"

Can anyone help?

Thanks

Edited

Hi,

Thanks for sharing this problem.

Do you have any variables showing up in the locals for your debugger? Are you able to inspect method parameter values or class members/fields?

Do you experience this problem on a small sample solution?
Hello,

Thanks for getting back to me so quickly.

[h]var mappedData = new Mock<IMappedData>();

// mock setup[/h]

var mappingApplicator = new MappingApplicator(_countryResolver.Object);

mappingApplicator.Verify(new List<IMappedData> { mappedData.Object, mappedData.Object });



I have locals up-until the mappingApplicator is instantiated. The second it passes that line, all locals disappear.

Oddly, when I reference the mappingApplicator's assembly from another solution/test project ncrunch works fine.

I created a new project and copied all the tests into it, debugging works fine.
Thanks for sharing these extra details.

The debugger itself is unfortunately a bit of a black box (unless you work within MS). The difference in behaviour is likely to be related to the structure of the PDB file, which NCrunch needs to reconstruct when it instruments the assembly.

To troubleshoot this issue, I'll need to have a sample solution that can produce it consistently in all environments. Unfortunately, there are too many complex interactions between black boxes to identify the issue any other way. If you manage to find a way to reproduce it, you're most welcome to submit code to me through the NCrunch contact form.

Post a reply

Log in to reply.