FIX: A .NET Framework 3.5-based WPF application behaves unpredictably or crashes when a HwndHost control or a WindowsFormsHost control is removed from the visual tree and tries to make a call on a message window
In a Microsoft .NET Framework 3.5-based Windows Presentation Foundation (WPF) application, a native window is managed by a HwndHost control or a WindowsFormsHost control. When the HwndHost control or the WindowsFormsHost control is removed from the visual tree, a message window is used as the parent window of the native window. When the control tries to make a call on the message window, the application behaves unpredictably or crashes.
For example, you have a HwndHost control or a WindowsFormsHost control that is hosted on a tab that is in a TabControl control. You deactivate the tab and then remove it from the visual tree by clicking another tab. When a Web page is loaded completely to the first tab, the application behaves unpredictably or crashes.
To resolve this issue, apply the hotfix package that is described in the following Microsoft Knowledge Base article:
2667241 An update rollup is available for Windows Presentation Foundation (WPF) for Microsoft .NET Framework 3.5
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
This hotfix alters the behavior of Windows Presentation Foundation (WPF). Before you apply this hotfix, WPF sets a message window as the parent window of native windows that are managed by the HwndHost control or by the WindowsFormsHost control. After you apply this hotfix, a window that WPF created is set as the parent window.
The message window that is mentioned in this article is set as the parent window when you create a message-only window. Message-only windows enable you to send and to receive window messages. Message-only windows have the following features:
Message-only windows are not visible.
Message-only windows have no z-order.
Message-only windows cannot be enumerated.
Message-only windows do not receive broadcast messages.