如何处理System.AccessViolationException在System.Windows.Forms.dll中发生?
问题描述:
我在写在C#中的Windows应用程序...如何处理System.AccessViolationException在System.Windows.Forms.dll中发生?
和我使用数据库和componentfactory的氪工具UI组件SQLEXPRESS ...
我运行在x86上。平台这个应用程序.. 。
应用程序的工作fine..but有时,当我关闭窗体System.AccessViolationException在System.Windows.Forms.dll中亮起处置......
我加入<legacyCorruptedStateExceptionsPolicy enabled="true" />
到的app.config理解过程[R <runtime></runtime>
...
我还添加了[HandleProcessCorruptedStateExceptions]
在主要功能和配置...
还是这个错误没有得到解决......
我附上了截屏image..kindly看图像也..
在此先感谢..
答
即使你设置HandleProcessCorruptedStateExceptions
属性,还是你需要包装你的代码try catch
[HandleProcessCorruptedStateExceptions]
public void TheFunction()
{
try
{
// Catch any exceptions in your code
}
catch (Exception e)
{
System.Console.WriteLine(e.Message);
}
}
是works..actually首先我加入尝试捕捉,但还没有把'HandleProcessCorruptedStateExceptions' ......既例外处理好.. –