I have an issue where I am trying to debug some code. I go to the code and right-click one of the coverage dots (its red) and select "Break into this covering test at this line". (Aside: I think NCrunch is getting this wrong for MSpec tests - this is not a covering test, it is covered code, but that's tangential).
OK this works, I hit my breakpoint. So I've broken in the debugger in a running test. Then I hit "Step into" to step into the method that's being called, but instead of entering my method, I end up at
public unsafe bool CheckForNewSession()
.
This obviously isn't my code, it's in RdiSessionIdReference.cs which is part of NCrunch. This appears to happen any time I try to step into a method while debugging a running test.
This is a bit of a showstopper. I love RDI but I can't have it getting in the way of my debugging. I've only just enabled it on this computer today and noticed this problem almost immediately.
I'm using MSpec as my testing/BDD framework, if that makes any difference.
As you've described, this is caused by the debugger stepping into NCrunch's instrumentation. For the time being, the fix for this is to turn on the 'Just My Code' VS debugging setting when running the debugger over code instrumented by RDI. This will prevent any accidental stepping into RDI's code.
The longer term fix for this is for us to mark RDI extensively with attributes to prevent the debugger from stepping into it. Unfortunately, the attributes we need for this don't exist prior to netstandard2.0, which means we either need to withdraw support for netcoreapp1.1, or we need to further cross-compile our runtime libraries for more fragmented support .. it will take us a while to sort this out. 'Just My Code' will get you working for now.
If its as simple as turning on "just my code" then as far as I'm concerned that's a fix. It never occurred to me that might be turned off (I checked, and it was).