Assembly.LoadFrom(...)

Discussion in 'ASP .Net' started by Henrik de Jong, Jul 8, 2004.

  1. I'm using a sort of plugin mechanism in combination with a commandfactory
    (pluginfactory). This factory looks in a special dir when it's starting.
    Each assembly(*.dll) will be loaded with Assembly.LoadFrom(assemblyname).
    After loading, it walks through all types in the assembly looking for a
    info-object. When this info-object is found, then it should be a known
    plugin-assemlby.

    My question is how to unload these assemblies?

    Kind regards,
    Henrik
     
    Henrik de Jong, Jul 8, 2004
    #1
    1. Advertising

  2. Henrik de Jong

    Scott Allen Guest

    Hi Henrik:

    Unfortunately you can't unload an assembly. MS gives several reasons
    for this, one being that the runtime can't be sure there isn't some
    thread still executing code in the assembly. The runtime would also
    have to go throw the memory heap used by the JIT and remove compiled
    methods to completely unload an assembly, and the design just isn't
    optimized for this scenario - it's optimized for adding new compiled
    methods.

    The workaround is to create a new application domain for your
    plug-ins, and unload the app domain. This has a price to pay in
    performance because you've introduced a remoting boundary.

    HTH,

    --
    Scott
    http://www.OdeToCode.com

    On Thu, 8 Jul 2004 11:50:52 +0200, "Henrik de Jong" <>
    wrote:

    >I'm using a sort of plugin mechanism in combination with a commandfactory
    >(pluginfactory). This factory looks in a special dir when it's starting.
    >Each assembly(*.dll) will be loaded with Assembly.LoadFrom(assemblyname).
    >After loading, it walks through all types in the assembly looking for a
    >info-object. When this info-object is found, then it should be a known
    >plugin-assemlby.
    >
    >My question is how to unload these assemblies?
    >
    >Kind regards,
    >Henrik
    >
     
    Scott Allen, Jul 8, 2004
    #2
    1. Advertising

  3. Henrik de Jong

    Natty Gur Guest

    Natty Gur, Jul 8, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wolf
    Replies:
    4
    Views:
    7,901
    dcushnie
    Sep 11, 2006
  2. Timothy Parez

    Assembly.LoadFrom() & GAC

    Timothy Parez, Feb 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,663
    Timothy Parez
    Feb 22, 2004
  3. posthumecaver
    Replies:
    0
    Views:
    343
    posthumecaver
    Aug 22, 2003
  4. Oenone
    Replies:
    0
    Views:
    548
    Oenone
    Jul 11, 2005
  5. pkellner
    Replies:
    0
    Views:
    523
    pkellner
    Apr 27, 2007
Loading...

Share This Page