We recently upgraded our app from .NET Framework 1.1 to 2.0 The conversion from Infrag 7.1 CLR 1 to CLR 2 went very smoothly but the application would hang with unresponsive windows after a user returned from the Screen being locked. While this is not necessarily an Infragistics problem I did come here looking for answers and found none so that's why I am posting. It turns out that certain controls register for the OnUserPreferenceChanged event which fires when you change your desktop background bitmap or unlock a screensaver.
I believe that some Infragistics controls also register for this event. The real problem is that in .NET Framework 2.0 the creation of handles for Windows is deferred (allegedly to improve performance). If you make the mistake I did and fire an asynchrounous thread to go and get some data to fill an Ultragrid before your UI window has a handle, InvokeRequired will lie to you. You will think you are on the main UI thread when you are still on the asynch thread. Then since you are not on a UI thread, messages are not received and the app hangs waiting forever.
A more elegant explanation from someone far brighter than I am:
http://ikriv.com:8765/en/prog/info/dotnet/MysteriousHang.html (Ivan refers to third party controls such as Infragistics and his sample of the bug with a Freezer app is especially useful in debugging- "E.g., Infragistics library creates a hidden form that it uses for device context measurements. Thus, you may be doing an innocent looking Infragistics call, but it will create a Windows Form and subscribe to the UserPreferenceChanged event. ")
UserPreferenceChanged
and a solution at:
http://krgreenlee.blogspot.com/2007/09/onuserpreferencechanged-hang.html
Microsoft's knowledge base article was not much help.
http://support.microsoft.com/default.aspx?scid=kb;en-us;943139
I hope this saves someone else from three weeks of banging their head against the wall.
This is exactly the problem I have. Thanks alot for your post.
Which solution did you use?
I followed Kim Greenlee's idea of insuring that every control has a handle
List lstHandles = new List();IntPtr hTemp;foreach (Control myCtrl in Controls){ hTemp = myCtrl.Handle; lstHandles.Add(hTemp);}hTemp = Handle;lstHandles.Add(hTemp);lstHandles.Clear();
AND moved my Asynch database query out of the Form Load