The Autos and Locals windows show variable values while you are debugging. The windows are only available during a debugging session. The Autos window shows variables used around the current breakpoint. The Locals window shows variables defined in the local scope, which is usually the current function or method.
Hover over a variable to see its value. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable. If the variable is an object, you can expand the object by clicking on the arrow to see the elements of that object.
In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.
Locals While debugging you can enable 'Locals' which will show you all variables in the current stack frame. Go to menu Debug->Windows->Locals to make it appear. Watch Although it is a little manually you also can use 'Watch' you can drag and drop any variable to this window or right click then add to watch.
Using Visual Studio 2008, 2010, 2012, 2013:
For the get
, type: ClassName.get_Counter()
For the set
, type: ClassName.set_Counter(int)
You'll get a "No Source Available" when the breakpoint is hit, but you'll get the calling location in the call stack.
I found this solution here on MSDN
On Visual Studio 2017:
Hover over "set" word -> right click -> Breakpoint -> Insert Breakpoint
Before:
After:
This question is very old but it is worth noting that it just works in VS 2015.
https://devblogs.microsoft.com/devops/set-breakpoints-on-auto-implemented-properties-with-visual-studio-2015/
class X {
public string name {
set;
get; // setting a breakpoint here will break in VS 2015!
}
}
If I was you, I'd temporarily make the property a standard one backed by an internal field...set your breakpoints, and then you can change it back after.
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