I have an UserControl that is made Visible. One of its custom properties is set to true
somewhere I do not know. All I know is that after setting its Visible
property to another value (true
), the custom property is true
. It is wrong that its value is set to true
, it should remain false
like it was before.
I am using .NET Framework 4.6.1. I have searched on StackOverflow and I did not find something useful. I tried using the debugger and the Watches window, this is how I found the information presented.
I debugged the program, and the value changes precisely when I step into the Visible = true
attribute, before other code is shown. The other code is the OnPaint
handler of my UserControl, and there, in the first line of code, the custom property already has this wrong value. There is no way to find what happens internally after stepping into the Visible assignment and before the custom property takes the value true
. I guess it is something like an Application.DoEvents()
call or another thread. How can I debug this so that I get to the code that changes the value of my custom property?
I have read the official documentation and I did not find something useful.
internal void SetChildVisible(ClockData td, bool v)
{
foreach (IClockView tv in td.MyTimerViews)
{
if (tv is ClockControl tc &&
tv.GetClocksView() == MyClockListView)
{
tc.Visible = v;
break;
}
}
MyClockListView.RefreshDisplay();
}
I would like to have some option somewhere in Visual Studio so I can debug situations like this.