Use of AppDomain.Load()


More from inside the
walls..  From the dev that owns the loader…
class=468303306-16042003>


style="FONT-SIZE: 10pt; COLOR: #00007f; FONT-FAMILY: Arial; mso-font-kerning: 18.0pt"> color=#0000ff>AppDomain.Load() is only meant to be called on the current
AppDomain (for use by Interop callers).  If you call it on a different
AppDomain, if the assembly successfully loads in the target appdomain, it will
then be loaded in the current appdomain, causing the FileNotFoundException for
you. />

style="FONT-SIZE: 10pt; COLOR: #00007f; FONT-FAMILY: Arial; mso-font-kerning: 18.0pt"> color=#0000ff>If you need to execute an exe, you should use
AppDomain.ExecuteAssembly() instead. 
Otherwise, you should change to use Assembly.Load() from within the
target appdomain.  To do that, create a type which extends
MarshalByRefObject in the target appdomain, and call Assembly.Load() from a
method in that type.  Be sure to not
pass any types/assemblies (besides your MarshalByRefObject type) back to the
original appdomain.  See
http://www.gotdotnet.com/team/clr/AppdomainFAQ.aspx#_Toc514058497 for
more info on how to do that.

color=#0000ff> style="FONT-SIZE: 10pt; COLOR: #00007f; FONT-FAMILY: Arial; mso-font-kerning: 18.0pt">