FIX: A worker thread in a .NET Framework 2.0-based Windows Forms application may be blocked when it calls the Control.Invoke method even if the GUI thread is idle

Article translations Article translations
Article ID: 969836 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

You are running a multithreaded Windows Forms application that you created by using the Microsoft .NET Framework 2.0. A worker thread may be blocked when it calls the System.Windows.Forms.Control.Invoke method, even if the Graphics User Interface (GUI) thread is idle.

CAUSE

The Control.Invoke method that is called by the worker thread uses the PostMessage API function to send a message to a message queue. The queue is specified by the window handle of the GUI control. However, before the message is processed, the GUI control thread has called the Control.Dispose method to delete the window handle. Therefore, the worker thread waits infinitely in the WaitOne method or in the WaitOneNative method that is called by the Control.Invoke method for the acknowledgement from the GUI control thread.

RESOLUTION

Hotfix Replacement Information

The hotfix that corresponds to KB969836 has been superseded with the hotfix KB981145, which contains all fixes that were previously included in KB969836. You should use the hotfix KB981145 to fix the issues described in KB969836. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
981145 Workflows gradually take longer to load in a workflow designer that is re-hosted in the .NET Framework 2.0

WORKAROUND

To work around this problem, you can use the Control.BeginInvoke method instead of the Control.Invoke method in the System.Windows.Forms namespace.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Properties

Article ID: 969836 - Last Review: August 4, 2010 - Revision: 4.0
APPLIES TO
  • Microsoft .NET Framework 2.0 Service Pack 2
Keywords: 
kbHotfixServer kbexpertiseadvanced kbqfe kbsurveynew KB969836

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com