I would like to avoid that the watch window collapse my list variable content on value change during the process of my application in debug mode. I don't know if i'm really clear, see pictures below:
Collapsed:
Expended:
I would like to see the content of my list and let the content of my list expanded even if a string of my list change. Is there a way to lock the watch window?
CTRL + M + M will collapse/expand the current section.
Right-click on a variable choose “Add Watch” in the context menu. Right-click on a variable in the DataTip and choose “Add Watch” “Add Watch” button from QuickWatch.
In fact, you can now right-click a variable name in the Local window and then select Break When Value Changes (see Figure 58). Visual Studio will automatically track your variable, and it will break the application execution when the variable value changes.
As @JasonH mentioned, list will stay expanded while variable references same object and watch will show modified element in red color. List will collapse when you assign new reference to a variable. I am not aware of any option to change this behavior.
As an alternative, you can pin items in a list you are interested in. Or you can pin all items. In this you will get list expanded event if reference changes. But It will be available only in this concrete tab. Here is an example and picture of each step:
var ints = new [] {"1", "2", "3", "4"};
ints[1] = "3";
ints = new[] { "1" };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With