Is try/catch around whole C# program possible?

后端 未结 2 512
刺人心
刺人心 2021-02-01 05:09

A C# program is invoked by:

Application.Run (new formClass ());

I\'d like to put a try/catch around the whole thing to trap any uncaught except

2条回答
  •  逝去的感伤
    2021-02-01 05:50

    To catch Windows Form's unhandled exceptions hook-up the AppDomain.UnhandledException and Application.ThreadException events.

    Of interest: Unexpected Errors in Managed Applications

提交回复
热议问题