Question

I know little bit about the concept of application domain. We can delete the appdomain to unload the dll. Is it possible to use appdomain for better exception handling? How it can be used?

Was it helpful?

Solution

As far as I know loading modules in child AppDomains will not offer better exception handling. In the MSDN page for AppDomain.UnhandledException Event it remarks that:

Starting with the .NET Framework version 2.0, this backstop for unhandled exceptions in child threads was removed, because the cumulative effect of such silent failures included performance degradation, corrupted data, and lockups, all of which were difficult to debug.

This means that an unhandled exception in a child thread even if the code is executed in a child AppDomain, will bring the whole process down.

Usually child AppDomains are used for the assembly unload feature that you mention, and for executing code in a sandbox (restricted security environment).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top