c# - 如何调试 Visual Studio 2010 中的属性集?

标签 c# visual-studio debugging properties breakpoints

<分区>

假设我有这个属性

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:

  1. Go to the Breakpoint window

  2. New->Break at Function…

  3. 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/

相关文章:

visual-studio - 在Visual Studio 2017中开发(.sass)

C 运行时库问题 MD/MDd

c# - 调试在 visual studio 宏中引用的自定义 dll

c# - 如何判断对象是否已被垃圾收集

c# - 在 DataGrid 的 PreviewMouseDown 事件中获取当前行

C# TPL 以并行方式调用任务并异步创建新文件

.net - .NET Windows 窗体事件以什么顺序触发?

shell - 如何调试fish脚本?

java - 如果语句会抛出异常,则停止的断点

c# - Json.Net 中的 "Current error context error is different to requested error"异常