Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / November 2006

Tip: Looking for answers? Try searching our database.

AppDomains and Exceptions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rjh - 19 Nov 2006 18:42 GMT
I use application domains to load third party DLL's. Ideally, if one of these
DLL's throws an exception, I do not want the exception to take down my
application. It seems that Application Domains are designed to isolate code.
I have researched quite a bit on this and there does not seem to be a way to
detect an exception in an app domain and report this error. What I want to do
is report the error, unload the DLL, then re-load it again. I can detect the
error with the UnHandledException handler in my main app, but by then its to
late, my app will then quit. Am I stuck? This is with .NET 2.0.

Thanks,

-Rich
Michael Nemtsev - 20 Nov 2006 05:32 GMT
Hello rjh,

You can't unload specific assembly.
just unload/load whole appdomain

r> I use application domains to load third party DLL's. Ideally, if one
r> of these DLL's throws an exception, I do not want the exception to
r> take down my application. It seems that Application Domains are
r> designed to isolate code. I have researched quite a bit on this and
r> there does not seem to be a way to detect an exception in an app
r> domain and report this error. What I want to do is report the error,
r> unload the DLL, then re-load it again. I can detect the error with
r> the UnHandledException handler in my main app, but by then its to
r> late, my app will then quit. Am I stuck? This is with .NET 2.0.
r>
---
WBR,
Michael  Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
rjh - 20 Nov 2006 13:06 GMT
Thanks for the reply. I understand that I can load/unload the appdomain. The
problem is this: The DLL's that I am loading/unloading are "plug-ins" to our
main app. There could be hundreds of these, and most are third party. Some
create their own threads. If there is an exception in one of their threads,
and they don't handle it, my application gets an UnHandledException event and
my application dies. This obviously is not acceptable. I need to way to
totally isolate these plug-ins. It looks like AppDomains is not going to work
for me?

-Rich

> Hello rjh,
>
[quoted text clipped - 17 lines]
> "At times one remains faithful to a cause only because its opponents do not
> cease to be insipid." (c) Friedrich Nietzsche
Michael Nemtsev - 20 Nov 2006 18:01 GMT
Hello rjh,

Sorry, but .NET 2.0 CLR design is that the most of exeptions leads to appdomain
unloading, albeit UnhandledException and  ThreadAbortException are being
notified.

But, u can use legacyUnhandledExceptionPolicy flag of runtime version to
return the 1.1 behaviour

Read more about this there http://msdn2.microsoft.com/en-us/library/ms228965.aspx

http://msdn2.microsoft.com/en-us/library/ms228965.aspx
r> Thanks for the reply. I understand that I can load/unload the
r> appdomain. The problem is this: The DLL's that I am loading/unloading
r> are "plug-ins" to our main app. There could be hundreds of these, and
r> most are third party. Some create their own threads. If there is an
r> exception in one of their threads, and they don't handle it, my
r> application gets an UnHandledException event and my application dies.
r> This obviously is not acceptable. I need to way to totally isolate
r> these plug-ins. It looks like AppDomains is not going to work for me?
r>
r> -Rich
r>
r> "Michael Nemtsev" wrote:
r>
>> Hello rjh,
>>
[quoted text clipped - 18 lines]
>> "At times one remains faithful to a cause only because its opponents
>> do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael  Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.