I am getting this warning from FxCop:
"'RestartForm' contains field 'RestartForm.done' that is of IDisposable type: 'ManualResetEvent'. Change the Dispose method on 'RestartForm' to call Dispose or Close on this field."
Ok, I understand what this means and why this is what needs to be done... Except System.Windows.Forms.Form
doesn't allow you to override either .Close()
or .Dispose()
, so what to do? Currently I'm running with this solution:
private void RestartForm_FormClosing(object sender, FormClosingEventArgs e)
{
done.Set();
done.Close();
}
Which works as intended for my application... But FxCop still shows this message. Am I covered and can I safely ignore it, or is there another way I should be doing this?