问题描述
我一直在努力避免这种警告,根据CA1063: Implement IDisposable correctly,我尝试并理解的是,终结器应该只将Dispose方法包含在false中。其余代码应写在其他地方。我尝试了类似Microsoft的示例那样的工具,但是当我添加Dispose方法时,出现一个错误,指出该dispose方法已经存在,Designer中已经存在的唯一Dispose。设计师是造成麻烦的人吗?
~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();
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)