Let's say I have this property
public ISetting Setting { get; set; }
How can I get breakpoint at the set? So that the program will pause when something is setting a value.
I try to make it this way
public IDatabaseConnectionSetting ConnectionSetting {
get;
set;
}
And put the breakpoint on the set;
line, but still it doesn't work. The red breakpoint highlighter highlights the whole property declaration
Press F5 and start debugging the solution B instance of Visual Studio. Then press F5 and start debugging the solution A instance of Visual Studio. Now both the instances of Visual Studio will be in debug mode.
In Solution Explorer, right-click the project and choose Properties. In the side pane, choose Build (or Compile in Visual Basic). In the Configuration list at the top, choose Debug or Release. Select the Advanced button (or the Advanced Compile Options button in Visual Basic).
Launch configurations# To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and VS Code will try to run your currently active file.
Debug from the DLL project Set breakpoints in the DLL project. Right-click the DLL project and choose Set as Startup Project. Make sure the Solutions Configuration field is set to Debug. Press F5, click the green Start arrow, or select Debug > Start Debugging.
There's a better solution here: Can't set breakpoints on an auto-property setter ? Why?
Using Visual Studio 2008, 2010, 2012:
Go to the Breakpoint window
New->Break at Function…
For the get, type: ClassName.get_CurrentFramesize()
For the set, type: ClassName.set_CurrentFramesize(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: http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/b1dd0dc3-e9c1-402a-9c79-a5abf7f7286a
See also: Debugging automatic properties
Use a full property rather than autoproperty.
The shortcut is propfull
private ISetting setting;
public ISetting Setting
{
get
{
return setting;
}
set
{
setting = value;
}
}
To use the code-snippet shortcut, type propfull
and then press TAB
twice.
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