3

在 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 实例?

大卫。

4

0 回答 0