C#:VS 2008调试器执行属性代码 [英] C#: VS 2008 debugger executing property code

查看:68
本文介绍了C#:VS 2008调试器执行属性代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下两行代码:

lstvbWerteC.Clear ();
if (...)

lstvbWerteC是List< T>的字段,则
与班级范围。如果在VS 2008调试器中,我在if语句上设置了一个断点,则我希望lstvbWerteC.Count为0,但实际上为1。我的类的某些属性确实填充了列表。为了防止调试器出现副作用,所有属性均具有属性 [DebuggerBrowsable(DebuggerBrowsableState.Never)] 。但是,只要看到本地窗口,调试器似乎就会执行填充列表的代码。隐藏本地窗口的情况下,列表始终为空,到达if断点。有关此类型问题的有关调试器详细信息的任何信息将不胜感激。

lstvbWerteC is a field of List<T> with class scope. If in the VS 2008 debugger I set a breakpoint on the if statement I would expect lstvbWerteC.Count to be 0, but instead it is 1. My class has some properties that indeed fill the list. To prevent side effects in the debugger all the properties have the attribute [DebuggerBrowsable (DebuggerBrowsableState.Never)]. Nevertheless as soon as the locals window is visible the debugger seems to execute the code filling the list. With the locals window hidden the list is always empty reaching the if-breakpoint. Any information on debugger details concerning this type of problem would be appreciated.

推荐答案

Visual Studio菜单:工具-选项-调试-常规。取消选中启用属性评估选项。

Visual Studio menu: Tools - Options - Debugging - General. Uncheck "Enable property evaluation" option.

这是Visual Studio 2010提供的。VisualStudio 2008应该具有相同的选项或相似的选项。

This is from Visual Studio 2010. Visual Studio 2008 should have the same option or something similar.

这篇关于C#:VS 2008调试器执行属性代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆