Catch block not catching exception

后端 未结 4 1839
你的背包
你的背包 2020-12-09 14:17

I have a child form that is throwing an ApplicationException in the Load event handler (intentionally for testing purposes). The parent form wraps the ChildForm.Show() meth

4条回答
  •  一向
    一向 (楼主)
    2020-12-09 14:34

    I have the same problem. What I eventually did was to catch all exceptions. In C#:

    Application.ThreadException += new ThreadExceptionEventHandler(MyHandler);
    

    And then show the form.

    I'd love to hear if anyone has a better solution.

提交回复
热议问题