C#/WPF app throwing a ObjectDisposedException; why am I not able to catch or get a stacktrace?

谁说胖子不能爱 提交于 2019-12-07 15:58:28

Another option would be to DebugDiag to catch that particular exception and generate a crash dump which could be analyzed in WinDbg via psscor2 or SOS. That will allow you to evaluate the stack trace.

DebugDiag: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=24370

Debugging CLR with WinDbg: http://www.codeproject.com/KB/debug/windbg_part1.aspx

A console window will show any exceptions thrown with a full stack trace. To add a console window to your WPF application:

  1. Go the project properties of your WPF application.
  2. Select the first (side-) tab, Application.
  3. Under Output type select Console Application.
  4. Build and run your app. It should start up with an additional console window. When it crashes you should see the exception and stack trace in it.

Try putting a try/catch inside of your main method, not around the exit handler. In WPF, the main method isn't always easy to find- see here for how to find it: http://joyfulwpf.blogspot.com/2009/05/where-is-main-method-in-my-wpf.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!