Issue
Locals only displays this
variable while debugging, other local variables are not available in Locals or Watch but can be re-evaluated in Intermediate Window in Visual Studio
Brief
I'm debugging an Xunit test for some code I am writing. The library I am testing targets ASP.NET Core RC1. Here is my project.json
:
{
"authors": [ "Matthew Abbott" ],
"commands": {
"test": "xunit.runner.dnx"
},
"description": "Provides tests for the Fx.Content.Composer package",
"dependencies": {
"xunit": "2.1.0-rc1-build3168",
"xunit.runner.dnx": "2.1.0-rc1-build204",
"Fx.Content.Composer": ""
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Runtime": "4.0.21-beta-23516"
}
}
},
"licenseUrl": "",
"projectUrl": "",
"tags": [ "" ],
"version": "1.0.0-*"
}
When debugging the unit test (I'm using Visual Studio's in built test features), I can set breakpoints, but the Locals/Watch windows don't allow me to inspect local variable declarations. I also do not get variable tooltips for those local variables.
If I copy and paste my statements into Intermediate, they are then added to scope, but I can't debug easily straight off the bat.
Things I've tried
Things of note
Any help would be greatly appreciated!
Update Based on Victor's comment, I tried stepping through into a method from that unit test, and initially a parameter is available in scope, but a variable defined further down is not.
Update: Note this answer only applies to Visual Studio 2015 Update 2. If you are missing locals in any other release of Visual Studio, something else is going on. You can only install the hotfix patch over Visual Studio 2015 Update 2. Visual Studio 2015 Update 3 and later already have the fix.
Original Answer:
This looks like a bug that was introduced in Visual Studio 2015 Update 2. Essentially the debugger is unable to inspect local variables in dynamic modules. We released a hotfix for it today. You can download the patch here. Documentation for the patch is here. Let me know if the patch does not fix your particular scenario.
Thanks!
-Patrick Nelson
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With