With MDA enabled in Visual Studio 2010, the constintenlty helper activates ReleaseHandleFailed for each CustomLineCap, for example:
GraphicsPath gp = new GraphicsPath();
CustomLineCap clp = new CustomLineCap(gp, null);
clp.Dispose();
Of course, this is a simple example, but even here I get an assistant call, which:
A SafeHandle or CriticalHandle of type
'System.Drawing.Drawing2D.SafeCustomLineCapHandle' failed to properly release the
handle with value 0x00000000. 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.)
Is this something wrong with the class? All available constructors of this class lead to this helper, no matter what form remains in gp. Finally, the question arises: how correctly should I handle instances of CustomLineCap?
Dawid.
source
share