问题描述
我有一个过得去的东西改变了类中的属性。我更改此代码的唯一有价值的地方是一条线,看起来像这样:
I have a property inside a class that is getting changed by something. The only place I change the value of this code is a line that looks like this:
pushpin.Position.Altitude = -31;
在Visual Studio中的调试,有没有办法看.Altitude为所作的任何更改,最好是它打破在改变的值赋值语句。
During visual studio debugging, is there a way to watch .Altitude for any changes made, preferably it breaks at the assignment statement that changes the value.
如果这是追查这个问题的正确途径,可能我对如何一步一步的教程/指令要做到这一点?
If this is the correct way to track down this problem, could I have a step-by-step tutorial/instruction on how to do this?
感谢。
推荐答案
如果这是一个财产,那么你可以通过添加一个断点属性的设置方法做到这一点。把光标放在SET语句,并按下F9键将创建一个破发点。
If this is a property then you can do this by adding a breakpoint to the set method of the property. Putting the cursor in the set statement and hit F9 will create the break point.
如果这是场那么有没有办法直接看这个。打破当一个领域变化的值是在C ++中,称为数据断点支持的操作,但在CLR不支持。最好的解决办法是到外地临时转换到属性和SET语句打破。
If this is a field then there's no way to watch this directly. Breaking when a field changes a value is a supported operation in C++, known as data break points, but is not supported in the CLR. The best work around is to convert the field to a property temporarily and break on the set statement.
修改
更新是根据OP说这是一个第三方的DLL。
Updating based on OP saying it's a 3rd party DLL.
在您要使用的Visual Studio的功能特性的打破了这种情况。 。第一步是禁用仅我的代码
In this case you want to use the Break at Function feature of Visual Studio. The first step is to disable Just My Code.
- 工具 - >选项 - >调试
- 取消选中启用仅我的代码
下一页实际设置指定的断点
Next actually set the named break point
- 打开了破发点窗口(调试 - >窗口 - >断点)
- 单击新建按钮并选择BREAK在功能
- 输入属性的名称。例如:Position.set_Altitude
您可能需要为了得到它的工作。
You may need to fully qualify the name in order to get it to work
这篇关于VS调试和看更改一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!