none
Is it advisable to load twowindows forms in different app domains? RRS feed

  • Question

  • Hi

    I am trying to load two assemblies containing Winforms in two different appdomains , What I want to acheive is that if due to some issue one screen crashes other should not affected.

    Is it a recommended way??

     

    Wednesday, January 28, 2009 6:10 AM

Answers

  • Microsoft certainly didn't think so.  I agree.  It is up to you to find out what the shrapnel does.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Tuesday, February 3, 2009 4:18 AM
    Wednesday, January 28, 2009 7:42 PM
    Moderator

All replies

  • It is not.  Aborting a thread that suffers an unhandled exception in a WF app just leaves shrapnel everywhere, including a dead window that you can't get rid of.  Only special hosts like ASP.NET and SQL Server can kill threads without much consequence.  It just sends an error response back to the requester, everybody else keeps humming along.
    Hans Passant.
    Wednesday, January 28, 2009 6:45 AM
    Moderator
  • Microsoft provides CAB which allows various GUI modules to be hosted in a single container.

    Currently all modules are loaded in a single app domain , so a crash in module kill the whole container.

    Now if the above is not recommended what should we do?

     

     

    Wednesday, January 28, 2009 7:06 AM
  • Click the OK button on the "We're sorry" dialog and let it send the error report to MSFT.  Avoid using anything that chronically destabilizes your app.
    Hans Passant.
    Wednesday, January 28, 2009 7:27 AM
    Moderator
  •  <runtime>
        <legacyUnhandledExceptionPolicy enabled="1" />
    </runtime>

    This is helping me acheive the desired behavior

    Any unhandled exception gets logged in AppDomain.CurrentDomain.UnhandledException handlers so I don't lose them.

    But is this the right approach??

     

    Wednesday, January 28, 2009 12:57 PM
  • Microsoft certainly didn't think so.  I agree.  It is up to you to find out what the shrapnel does.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Tuesday, February 3, 2009 4:18 AM
    Wednesday, January 28, 2009 7:42 PM
    Moderator