When debugging my .NET Core 2.2 project (XUnit 2.4.1), if I have an exception in my test code, I can't hover over other variables in the method and see their values.
If I try Quickwatch, it says "The name [blah] does not exist in the current context".
I'm fairly certain this is caused by something funky in the debug information that exists because of the async method block.
Are you working with a portable PDB, or a Win32 one? Does switching between them make any difference?
Are you able to produce this problem with a small sample project that you can share with me? You can submit ZIPed code through the NCrunch contact form.
Presently, I don't know how to reproduce this issue. The interactions here are complex enough that it will be hard (maybe impossible) to narrow it down through Q&A and guesswork. Something is different about the structure of this assembly.
Is there any chance you can reproduce this in a sample project that you can share with me? Note that you can submit code in ZIP form through the NCrunch contact form.
Hmm. I just spent about half an hour stripping out most of the functionality from my solution, so I was just left with one controller and a few test classes, so that I could upload it to you.
Switched to Optimised mode = it now builds and runs.
So then I switched back to my develop branch (i.e. with functionality restored, and around 300 tests), and hey presto, Optimised mode still builds and runs.
Let's see what happens if I close and open VS... yep, Optimised mode can still build. Cool.
OK, let's see if my original bug is now fixed...
Nope. I still get "The name 'service' does not exist in the current context".
Let's see if when I switch back to my "stripped down controller and only a few test classes for Remco" branch, if the same thing still happens... yes, it does. I will upload a solution for you.
Thanks for confirming! We were corrupting some of the metadata inside the PDB. It was affecting all projects building a non-portable PDB and only affecting yield/async methods as far as I can tell.