Answered by:

Is there any known issue in C# 3.5 where programs hang on System.Windows.Forms.ContainerControl.UpdateFocusedControl() ?

Question

I have a problem with the code I'm working with that I don't quite know how to get my head around. What I am doing is a quite complex application (which unfortunatly is difficult to recreate) that uses MDI child forms as well as supports docking windows in panels left, right, top and bottom in the main form. What I have noticed is that if I dock a MDI window/usercontrol in a panel (docking takes the contained UserControl from within my MDI Form and places it in the panel), presses within the docked UserControl to focus it (a listener calls focus() on the user control) and then finally press close on it, my whole application hangs.

Using a profiler I see that everything stops at System.Windows.Forms.ContainerControl.UpdateFocusedControl(), which is executed from the base.Dispose method of my windowform (which inherits from Form). The profiler tells me that the computer takes up 50% of cpu from that of the computer hanging. Although there is only one call to System.Windows.Forms.ContainerControl.UpdateFocusedControl(), I have 12 000 000 calls to NotifyLeave within this method, and 18 000 000 calls to get_ParentInternal.

Answers

As far as I know, about "System.Windows.Forms.ContainerControl.UpdateFocusedControl()" problem, there are some related problem information HERE.

1. Please have a try to run your application in another computer.2. Please consider providing your sample code to do the further troubleshooting.3. Please consider giving feedback about this problem to https://connect.microsoft.com/dashboard/info/ , engineers there will provide you with quicker and better responses.Thank you!

All replies

As far as I know, about "System.Windows.Forms.ContainerControl.UpdateFocusedControl()" problem, there are some related problem information HERE.

1. Please have a try to run your application in another computer.2. Please consider providing your sample code to do the further troubleshooting.3. Please consider giving feedback about this problem to https://connect.microsoft.com/dashboard/info/ , engineers there will provide you with quicker and better responses.Thank you!

at the given time I had to give up the issue because I couldn't find anyway to make progress with the bug. Now, half a year later, I have tried the scenario again (that always gave the bug) but this time without having the application locking up. I can't remember or say if there was any explicit patch that I have installed, but I can't think of any other explanation to this sudden improvement other than that some patch has been installed.