CustomLineCap.Dispose()上的ReleaseHandleFailed

时间:2012-05-02 09:57:37

标签: c# .net visual-studio-2010 exception dispose

在Visual Studio 2010中启用MDA后,助手constintenlty会在每个CustomLineCap配置上激活ReleaseHandleFailed,例如:

    GraphicsPath gp = new GraphicsPath();
    CustomLineCap clp = new CustomLineCap(gp, null);
    clp.Dispose();

当然这只是一个简单的例子,但即使在这里,我也会得到助理的电话,即:

    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.)

班级有问题吗?无论gp中的残留形状如何,此类的所有可用构造函数都会导致此辅助行为。最后问题是:我应该如何正确处理CustomLineCap实例?

的Dawid。

0 个答案:

没有答案
相关问题