S
Sam Martin
Hi All,
I've got a problem where my application loads an assembly in the running
AppDomain when it shouldn't.
Ok, I've got a RemotingHost application that configs the remoting stuff and
then...
asks the user for a list of .net DLLs.
the app then copies a these assemblies to a cache folder along with my
RemotingClient app. Once copies i config a AppDomain setup and create a new
AppDomain.
Once created, i loop through the user chosen assemblies and load into the
AppDomain. I then AppDomain.ExecuteAssembly my RemotingClient.
The purpose is so that I can dynamically load and unload assemblies and
report on type information to my main app (in this case the RemotingHost).
Everything works fine in principal, however when I load the DLLs from my
cache folder the assembly is actually loaded in both AppDomains.
I know if i reference a type across AppDomain, it will cause the Framework
to load the assembly in the other AppDomain, but all i'm doing it is loading
it?
Any ideas? (please help
TIA
Sam Martin
(code sample below)
System.IO.Directory.CreateDirectory(Application.StartupPath+"\\cache");
// copy my RemotingClient.exe to the cache
// Set up the AppDomainSetup
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = Application.StartupPath+"\\cache\\";
setup.ConfigurationFile = "";
// Set up the Evidence
System.Security.Policy.Evidence baseEvidence =
AppDomain.CurrentDomain.Evidence;
System.Security.Policy.Evidence evidence = new
System.Security.Policy.Evidence(baseEvidence);
// evidence.AddAssembly("(some assembly)");
// Create the AppDomain
AppDomain newDomain = AppDomain.CreateDomain("temp", evidence, setup);
foreach(string an in this.listBoxAsmList.Items)
{
// copy the specified assembly to cache
string asmn = an.ToLower().Replace(".dll","");
asmn = MyFuncToGetAsmDisplayName(an);
newDomain.Load(asmn);
}
newDomain.ExecuteAssembly("RemotingClient.exe);
AppDomain.Unload(newDomain);
I've got a problem where my application loads an assembly in the running
AppDomain when it shouldn't.
Ok, I've got a RemotingHost application that configs the remoting stuff and
then...
asks the user for a list of .net DLLs.
the app then copies a these assemblies to a cache folder along with my
RemotingClient app. Once copies i config a AppDomain setup and create a new
AppDomain.
Once created, i loop through the user chosen assemblies and load into the
AppDomain. I then AppDomain.ExecuteAssembly my RemotingClient.
The purpose is so that I can dynamically load and unload assemblies and
report on type information to my main app (in this case the RemotingHost).
Everything works fine in principal, however when I load the DLLs from my
cache folder the assembly is actually loaded in both AppDomains.
I know if i reference a type across AppDomain, it will cause the Framework
to load the assembly in the other AppDomain, but all i'm doing it is loading
it?
Any ideas? (please help

TIA
Sam Martin
(code sample below)
System.IO.Directory.CreateDirectory(Application.StartupPath+"\\cache");
// copy my RemotingClient.exe to the cache
// Set up the AppDomainSetup
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = Application.StartupPath+"\\cache\\";
setup.ConfigurationFile = "";
// Set up the Evidence
System.Security.Policy.Evidence baseEvidence =
AppDomain.CurrentDomain.Evidence;
System.Security.Policy.Evidence evidence = new
System.Security.Policy.Evidence(baseEvidence);
// evidence.AddAssembly("(some assembly)");
// Create the AppDomain
AppDomain newDomain = AppDomain.CreateDomain("temp", evidence, setup);
foreach(string an in this.listBoxAsmList.Items)
{
// copy the specified assembly to cache
string asmn = an.ToLower().Replace(".dll","");
asmn = MyFuncToGetAsmDisplayName(an);
newDomain.Load(asmn);
}
newDomain.ExecuteAssembly("RemotingClient.exe);
AppDomain.Unload(newDomain);