VS debugging and watching a variable for changes

后端 未结 3 2396
太阳男子
太阳男子 2021-02-19 23:03

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.Pos         


        
3条回答
  •  无人及你
    2021-02-19 23:23

    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.

    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.

    EDIT

    Updating based on OP saying it's a 3rd party DLL.

    In this case you want to use the Break at Function feature of Visual Studio. The first step is to disable Just My Code.

    • Tools -> Options -> Debugger
    • Uncheck "Enable Just My Code"

    Next actually set the named break point

    • Open up the break points window (Debugger -> Windows -> Break Points)
    • Click on the new button and select "Break at function"
    • Enter the name of the property. For example: Position.set_Altitude

    You may need to fully qualify the name in order to get it to work

提交回复
热议问题