与System.ObjectDisposedException程序崩溃 [英] Program crash with System.ObjectDisposedException
问题描述
我有我的节目一个奇怪的问题。我正在开发一个Windows窗体应用程序。当我调试它通过Visual Studio(F5),它完全正确的,但是当我运行它的可执行崩溃,并给了我型System.ObjectDisposedException未处理的异常出现在mscorlib.dll。
I'm having a weird problem with my program. I'm developing a windows form application. When I debug it through Visual Studio (F5) it works perfectly correctly, but when I run its executable it crashes and gives me "An unhandled exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll".
我试图把一个顶级(在我最外面的功能)的try / catch捕捉此异常,但仍程序崩溃。缺少什么我在这里?
I tried to put a top level (on my outermost function) try/catch for catching this exception, but still the program crashes. What am I missing here?
我,因为我不得不上传整个代码给你看是哪里的问题未上传的代码。
I didn't upload the code because I had to upload the whole code for you to see where the problem is.
推荐答案
哇,这不是由顶级catch块捕捉到一个的ObjectDisposedException?
Wow, an ObjectDisposedException that isn't caught by a top-level catch block?
我不知道我会在这种情况下做的 - 很明显,你想看到的堆栈跟踪,并发现它正是被释放。有几个未追赶能例外,但这个人是不是其中之一。我可能会附加一个处理程序的AppDomain.UnhandledException事件,看看是否能发现任何东西。
I'm not sure what I would do in this case - obviously, you want to see the stack trace and find out just what it is that was disposed. There are a few un-catch-able exceptions, but this one isn't one of them. I'd probably attach a handler to the AppDomain.UnhandledException event, and see if that found anything.
这篇关于与System.ObjectDisposedException程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!