C# 出现“已关闭 Safe handle”的错误

简介:
今天写C#的时候无缘无故出现了 一个“已关闭 Safe handle”的错误,上网Google了一下,发现原来是SerialPort类引起的问题,原本的代码是设置好一个串口类后立刻打开了一个对话框,但此时就会跳出“已关闭 Safe handle”的错误,原本我以为是对话框里面的对象调用出现了问题,但是检查跟踪了好久也没找到问题所在,最后我在生成该对话框对象之前加入了SerialPort的关闭方法close后,问题就迎刃而解了.



本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/archive/2010/03/26/1697092.html如需转载请自行联系原作者
相关文章
|
1月前
|
SQL
启动mysq异常The server quit without updating PID file [FAILED]sql/data/***.pi根本解决方案
启动mysq异常The server quit without updating PID file [FAILED]sql/data/***.pi根本解决方案
31 0
|
NoSQL API 语音技术
Freeswitch如何接收 RECORD_STOP 和 RECORD_START事件
Freeswitch如何接收 RECORD_STOP 和 RECORD_START事件
|
关系型数据库 MySQL Unix
mysqld_safe: command not found 解决方法
mysqld_safe: command not found 解决方法
1351 0
飞思卡尔codewarrior下载出现USBD connection error:Failed to connect to targe(Reason :Target reset pin time out)
飞思卡尔codewarrior下载出现USBD connection error:Failed to connect to targe(Reason :Target reset pin time out)
飞思卡尔codewarrior下载出现USBD connection error:Failed to connect to targe(Reason :Target reset pin time out)
|
安全 Java 容器
简述快速失败(fail-fast)和安全失败(fail-safe)?
快速失败(fail-fast)和安全失败(fail-safe)
143 0
|
C语言
[Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode 解决方法
[Error] ‘for’ loop initial declarations are only allowed in C99 or C11 mode [Note] use option -std=c99,-std=gnu99,-std=c11 or-std=gnu11 to compile your code
1184 0
[Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode 解决方法