2012-12-31

ReleaseHandleFailed was detected when showing WPF splash screen

Here is some code to show a WPF splash screen:

public partial class App
{
    protected override void OnStartup(StartupEventArgs e)
    {
        SplashScreen splash = new SplashScreen(@"Images\splash.bmp");
        splash.Show(false, true);
        splash.Close(new System.TimeSpan(0, 0, 5));
        base.OnStartup(e);
    }
}

If you then cause Visual Studio to break on all exceptions from Debug | Exceptions on the VS2010 menu and run this code, you get the following error:

ReleaseHandleFailed was detected
Message: A SafeHandle or CriticalHandle of type 'BitmapHandle' failed to properly release the handle with value 0x4705245A. This usually indicates that the handle was released incorrectly via another means (such as extracting the handle using DangerousGetHandle and closing it directly or building another SafeHandle around it.)


Sounds like something isn't being released correctly, right? This is probably a bug in the .NET framework. A web search reveals that others have seen the same thing. When this was reported to Microsoft, they responded. Here is the response (from here):
Posted by Microsoft on 1/26/2012 at 4:24 PM
Thank you very much for your feedback. At this point in time we will not be following up on this issue. Thanks again.

WPF Team
Microsoft provides no information. There is no telling us if it's by design and isn't critical. There are no workarounds. The only information is that the Microsoft WPF team isn't going to look into it. Thank you very much.

The only "solution" is to ignore the problem by turning off Managed Debugging Assistants | Release Handle Failed in Visual Studio. I then put my hands over my ears and sing La La La La, and hope that whatever wasn't released correctly isn't important.

No comments :

Post a Comment