2

I was just searching for debugging options in visual studio debugger where I can simulate missing object conditions ie., (this.XX == null). I wanted to know is there any way i can assign a null value to the field "XX" in debug session? What i wanted exactly is equivalent to de-allocating the memory assigned to entire XX field (the XX internally contains several other data structures).

All my search results tells me how to edit but i would like to know how to de-allocate? Does MSVC has any such options?

inquisitive
  • 1,558
  • 4
  • 16
  • 22

2 Answers2

4

If you set a breakpoint you should be able to hover over the this.XX property which will bring up its current value, you can then click into the value and replace it with null.

Alternatively you could use a conditional statement in your code like so

#if DEBUG
    this.XX = null;
#endif
Chris
  • 26,744
  • 48
  • 193
  • 345
0

Consider Immediate window, also.

You can type some statements inside it, and add some code while the code is paused in a breakpoint.

Community
  • 1
  • 1
Emanuele Greco
  • 12,551
  • 7
  • 51
  • 70