B
Basti
Hello,
I'm working with .Net 2.0. I tried to get attributes of an unloaded
assembly. So, the sole way I know is to create a new child application
domain, in this app domain I load the assembly, read out the
attributes, and unload the child app domain. But in this moment, I load
the assembly into the child app domain, the assembly occurs in the
parent app domain, too. And after unloading the child app domain the
assembly is still loaded in the parent domain. Have anybody an idea?
Here is my code:
static void Main(string[] args)
{
foreach (Assembly ass in
AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.WriteLine("------------------------------------------------------------------------------");
AppDomain domain = AppDomain.CreateDomain("ChildDomain");
domain.Load("TestAssembly");
foreach (Assembly ass in domain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.WriteLine("------------------------------------------------------------------------------");
foreach (Assembly ass in
AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.WriteLine("------------------------------------------------------------------------------");
AppDomain.Unload(domain);
foreach (Assembly ass in
AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.ReadLine();
}
Thx
I'm working with .Net 2.0. I tried to get attributes of an unloaded
assembly. So, the sole way I know is to create a new child application
domain, in this app domain I load the assembly, read out the
attributes, and unload the child app domain. But in this moment, I load
the assembly into the child app domain, the assembly occurs in the
parent app domain, too. And after unloading the child app domain the
assembly is still loaded in the parent domain. Have anybody an idea?
Here is my code:
static void Main(string[] args)
{
foreach (Assembly ass in
AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.WriteLine("------------------------------------------------------------------------------");
AppDomain domain = AppDomain.CreateDomain("ChildDomain");
domain.Load("TestAssembly");
foreach (Assembly ass in domain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.WriteLine("------------------------------------------------------------------------------");
foreach (Assembly ass in
AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.WriteLine("------------------------------------------------------------------------------");
AppDomain.Unload(domain);
foreach (Assembly ass in
AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine(ass.FullName);
}
Console.ReadLine();
}
Thx