Windows Ce 6.0 上的 Compact Framework 应用程序中引发应用程序错误
当我使用取消按钮关闭程序时,出现应用程序错误,它所做的只是关闭表单。
错误说: “应用程序 appName.exe 遇到严重错误,必须关闭”
如何开始修复它?这不是抛出异常;没有给出其他信息。 它可能是什么?我该如何解决它?
I get an application error thrown when I close the program using as cancel button which all it does is close the form.
The error says:
"Application appName.exe encountered a serious error and must shut down"
How do I start fixing it? It is not a thrown exception; no other info is given.
What could it be and how do I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
事情就是这样。我的应用程序有两个表单 - 登录和主表单,所有操作都在主表单中发生。登录表单有两个按钮(登录和取消)。登录按钮使用户登录,关闭登录表单并打开主表单。取消按钮只是关闭登录表单。要关闭表单,我只需使用 this.Close()。
但发生的情况是,我仍然需要通过执行以下操作来显式处理登录表单:
在退出程序之前(在我的 Program.cs 中)
所以这解决了它。我必须确保在两种情况下都执行此操作:当用户登录时以及当他们选择不登录时。
重要的事实是 frmLogin 是模态的,因此关闭时不会自动调用 Dispose()。
Here is what it was. My application has two forms - login and main form where all the action happens. The login form has two buttons (Login and Cancel). Login button logs user in, closes the login form and opens the main form. Cancel button just closes the login form. To close the form I simply used this.Close().
What was happening though is that I still needed to dispose of the login form explicitly by doing something like:
before exiting the program (in my Program.cs)
So this solved it. I had to make sure that this was being done in both cases: when the user logs in as well as when they choose to not log in.
Crucial fact is that frmLogin is modal, hence Dispose() is not called automatically when closed.
这通常是由托管代码无法捕获的进程空间中的系统级异常引起的。通常,当您 P/Invoke 到本机代码并为其提供错误的指针/参数时,就会发生这种情况,并且会导致 CLR 无法捕获的本机异常。
This is typically caused by a system-level exception in your process space that managed code is unable to catch. Typically it happens when you P/Invoke out to native code and give it a bad pointer/parameter and it causes a native exception that is uncaught by the CLR.
在 Program.cs 中的 Application.Run(...) 行周围抛出一个 try/catch 块,如下所示:
您看到的消息意味着抛出了一个未被捕获的异常。
Throw a try/catch block around the Application.Run(...) line in your Program.cs, like this:
The message you're seeing means there's a thrown exception that isn't being caught.
查看一些 GUI 组件、DLL 或端口资源。有时是未关闭的端口,有时是一些 GUI 组件(我处理一些列表 GUI 组件)
Look at some GUI components, DLLs or port resources. Some time is unclosed port, some time some GUI component (i deal with some List GUI component)
我安装了 resharper,它的缓存正在产生问题。我删除了缓存并且它起作用了。
I had resharper installed and its cache was creating issue. I deleted the cache and it worked.