title: What unusual thing takes place when I step into a Control.Visible = true assignment?
body: <p>I have an UserControl that is made Visible. One of its custom properties is set to <code>true</code> somewhere I do not know. All I know is that after setting its <code>Visible</code> property to another value (<code>true</code>), the custom property is <code>true</code>. It is wrong that its value is set to <code>true</code>, it should remain <code>false</code> like it was before.</p>
  
  <p>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.</p>
  
  <p>I debugged the program, and the value changes precisely when I step into the <code>Visible = true</code> attribute, before other code is shown. The other code is the <code>OnPaint</code> 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 <code>true</code>. I guess it is something like an <code>Application.DoEvents()</code> call or another thread. How can I debug this so that I get to the code that changes the value of my custom property?</p>
  
  <p>I have read <a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.control.visible?view=netframework-4.6.1" rel="nofollow noreferrer">the official documentation</a> and I did not find something useful.</p>
  
  <pre><code>internal void SetChildVisible(ClockData td, bool v)
  {
      foreach (IClockView tv in td.MyTimerViews)
      {
          if (tv is ClockControl tc &amp;&amp;
              tv.GetClocksView() == MyClockListView)
          {
              tc.Visible = v;
              break;
          }
      }
      MyClockListView.RefreshDisplay();
  }
  </code></pre>
  
  <p>I would like to have some option somewhere in Visual Studio so I can debug situations like this.</p>