https://github.com/bblanchon/unhandledexceptions
Dealing with unhandled exception in C# projects
https://github.com/bblanchon/unhandledexceptions
Last synced: 2 months ago
JSON representation
Dealing with unhandled exception in C# projects
- Host: GitHub
- URL: https://github.com/bblanchon/unhandledexceptions
- Owner: bblanchon
- Created: 2013-12-04T12:32:04.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-04T19:10:56.000Z (over 11 years ago)
- Last Synced: 2025-02-09T04:27:34.612Z (4 months ago)
- Language: C#
- Homepage:
- Size: 125 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Properly dealing with unhandled exceptions
Here are sample projects showing how to display a custom dialog box when an unhandled exception occurs in:
1. A Console application
2. A WinForm application
3. A WPF applicationExceptions are caught only if the debugger is attached.
In other word, they are still caught by Visual Studio, but your customer will always see the custom dialog box.The principle is simple:
1. Attach to event `AppDomain.CurrentDomain.UnhandledException`
2. Check `System.Diagnostics.Debugger.IsAttached`
3. Show custom dialog
4. Exit the applicationSee http://blog.benoitblanchon.fr/unhandled-exceptions/