Had a really bizarre and annoying error. I had a .Net WinForms app that started with a code block like this:
The only problem was, after one exception caused a restart (which had a side-effect of detaching the debugger), every other exception would throw a standard .Net "unhandled exception" box. Huh?
The right combination of Google search terms finally brought me to this page. Yes, apparently the above construct is fine running in a debugger, but not so much in stand-alone.
The solution, as described on the referenced page, is instead of using
try...catch, bind to the
Application.ThreadException event (which works both with and without a debugger attached), like so:
Very simple fix for a very aggravating little problem. Thank you, Craig Andera.