Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 cannot inspect variable values on Razor Page View when debugging

I'm working with ASP.NET core 2.0. When debugging, I want to inspect the values of some variables on my razor views, however it's not showing the values when I mouse over them, it just shows the variables Type, like it would when not debugging.

I found the following question posted over 2 years ago with the same problem in VS2015, however the suggestions there have not worked for me, it also suggested it was a known problem, and was to be fixed in a VS2015 update.

'Use Managed Compatibility mode' under Tools->Options-Debugging didn't solve it.

I'm running VS2017 Community v15.7.2

Cannot See Values While Debugging ASP.NET Core

like image 474
Ryan. Avatar asked May 22 '18 23:05

Ryan.


People also ask

How can I change variable value while debugging in Visual Studio?

Solution 3. Set a break point where your variable is used and start debugging. When execution stops at the break point, change the content of your variable in the local window and resume execution by pressing F5.

Can you debug razor pages?

Set a breakpoint on line 17. Run the app again. You can even debug the Razor Pages with markup and inspect the values of variables!

How do I inspect a variable in Visual Studio?

Open the QuickWatch window by right clicking on a variable and selecting “QuickWatch…” or by using the keyboard shortcut Shift+F9.


1 Answers

As of 7/3 this appears to be a known issue with a fix in the works. See (now closed) Visual Studio bug #249225, and it's linked item Visual Studio Bug #246728. Consensus appears to be that this broke in the 15.7+ builds, with recommendations to use the watch window as commented above or downgrade to a 15.6 build as potential workarounds.

On the linked ticket, recent comment indicates it may be fixed with the 15.8 preview, so work is ongoing.

Hope this helps anyone else who wanders by!

like image 129
Scott Avatar answered Oct 24 '22 17:10

Scott