I have been trying to avoid this warning, what I have tried and understand according to CA1063: Implement IDisposable correctly is that the finalizer should just include the Dispose method in false. And the rest of the code should be written somewhere else. I tried implement like, the example from Microsoft, but when I add the Dispose method, appears an error saying that the dispose method already exists, the only Dispose that already exists its in the Designer. Is the designer the one who is causing trouble?
~TimerUpdate()
{
Dispose(false);
try
{
this.matlab = null;
this.command = null;
}
catch(Exception ex)
{
Console.WriteLine("Exception in " + this.GetType().Name + ".cs: " + System.Reflection.MethodBase.GetCurrentMethod().Name + "(): " + ex.Message);
this.Dispose();
}
}
private void TimerUpdate_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
this.updateRateBox_ValueChanged(sender, e);
this.updateRateCAN_ValueChanged(sender, e);
this.matlab = null;
this.Dispose();
}
catch(Exception ex)
{
Console.WriteLine("Exception in " + this.GetType().Name + ".cs: " + System.Reflection.MethodBase.GetCurrentMethod().Name + "(): " + ex.Message);
this.Dispose();
}
}