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

Notification

Icon
Error

Debuging a test - watch issue
JamesGrafton
#1 Posted : Wednesday, November 8, 2017 10:08:16 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/17/2016(UTC)
Posts: 4
Location: United Kingdom

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
Remco
#2 Posted : Wednesday, November 8, 2017 10:17:09 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
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?
JamesGrafton
#3 Posted : Wednesday, November 8, 2017 10:54:54 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/17/2016(UTC)
Posts: 4
Location: United Kingdom

Hello,

Thanks for getting back to me so quickly.

Quote:
var mappedData = new Mock<IMappedData>();

// mock setup


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.
Remco
#4 Posted : Wednesday, November 8, 2017 11:17:38 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
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.
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.029 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download