Samples: Extensible calculator fails at managing exceptions

Jun 5, 2009 at 10:18 PM
Edited Jun 6, 2009 at 2:35 AM

See linked picture.

Is the calculator which handles unhandled exceptions supposed to crash?

Edit: Answering myself; there doesn't seem to be a way on the CLR to catch exceptions and keep the application from crashing.

Jun 8, 2009 at 7:08 PM

Yeah, it seems that the default CLR 2 policy undermines one of the potentially coolest things about MAF: to be able to unload/reload an AppDomain that has an unhandled exception.

Part of the reason for the change in policy, and a description of changes coming in CLR 4, is here in this excellent article:

I corresponded a bit with Andrew Pardoe (the author of that article) and he said this:

"Thanks, I’m glad you liked the article. There’s been a healthy discussion about this on our CLR Team blog at

You can use the CLR Hosting APIs ( to set the unhandled exception policy. The default policy is to tear down the process which is the safest action to take if the process has potentially been corrupted.

I can see that there’s not a good way to tell from the AppDomain.UnhandledExceptionNotification whether the exception that was uncaught was a CSE or not. I’ll follow up with the team about that."

I haven't had a whole lot of luck with the suggested work-around, though.  If anyone else gets it working, I'd love to hear about it!