<分区>
假设我有这个属性
public ISetting Setting { get; set; }
如何在集合处获取断点?这样程序就会在设置值时暂停。
我试着这样做
public IDatabaseConnectionSetting ConnectionSetting {
get;
set;
}
并将断点放在set;
行,但还是不行。红色断点荧光笔突出显示整个属性声明
<分区>
假设我有这个属性
public ISetting Setting { get; set; }
如何在集合处获取断点?这样程序就会在设置值时暂停。
我试着这样做
public IDatabaseConnectionSetting ConnectionSetting {
get;
set;
}
并将断点放在set;
行,但还是不行。红色断点荧光笔突出显示整个属性声明
最佳答案
这里有一个更好的解决方案: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
关于c# - 如何调试 Visual Studio 2010 中的属性集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7184521/