Winform 统一捕获异常,捕获未处理异常
2014-07-31 08:54
471 查看
using System; using System.Windows.Forms; //注册全局的异常处理程序,扑获产生的异常。 namespace Zhengzuo.CSharpCode { static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); } static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { throw new Exception("The method or operation is not implemented."); } static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { throw new Exception("The method or operation is not implemented."); } } }
相关文章推荐
- C#_WinForm 统一捕获未处理的异常
- C# WINFORM应用程序未处理异常的统一处理技巧
- winform中捕获程序未处理的所有异常
- winform 捕获并处理未处理的异常
- Spring boot异常统一处理方法:@ControllerAdvice注解的使用、全局异常捕获、自定义异常捕获
- C#_WinForm捕获未处理的异常
- C# WinForm捕获未处理的异常实例解析
- C# WinForm捕获未处理的异常
- HandlerExceptionResolver统一捕获系统异常做处理
- C#_WinForm捕获未处理的异常
- C# WinForm捕获全局异常(捕获未处理的异常)
- C# WinForm捕获未处理的异常
- C# WINFORM应用程序未处理异常的统一处理技巧(转载)
- winform中捕获程序未处理的所有异常
- WINFORM未处理异常之捕获
- winform程序不能同时开启两个应用程序的判断以及捕获全局未处理异常
- 【Golang】如何统一处理HTTP请求中的异常捕获
- 关于SQLserver2005事务和异常处理的联合处理以及在c#中的异常捕获
- .Net 下未捕获异常的处理
- .Net 下未捕获异常的处理