I
illegal.prime
Hey all, so I've noticed that when I load assemblies dynamically in my
own custom ResolveEventHandler that their Modules do not get returned
when I invoke
Process.GetCurrentProcess().Modules
Here is some pseudo code to show what I'm talking about:
public class Foo
{
public Foo ()
{
SomeClassInDynamicallyLoadedAssembly myObj = new
SomeClassInDynamicallyLoadedAssembly();
foreach (ProcessModule module in
Process.GetCurrentProcess().Modules)
{
Trace.WriteLine("module: "+module.FileName);
}
}
public static int main (string [] args)
{
AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(CurrentDomain_AssemblyResolve);
Foo foo = new Foo();
}
private static Assembly CurrentDomain_AssemblyResolve(object sender,
ResolveEventArgs args)
{
// get the bytes for this assembly - wherever it might be (could be
an embedded resource)
return Assembly.Load(bytes);
}
}
I can see that the assembly is getting loaded without issue since I can
use the classes that are stored in it. But that module doesn't appear
in the current processes list of modules.
any suggestions?
Thanks,
Novice
own custom ResolveEventHandler that their Modules do not get returned
when I invoke
Process.GetCurrentProcess().Modules
Here is some pseudo code to show what I'm talking about:
public class Foo
{
public Foo ()
{
SomeClassInDynamicallyLoadedAssembly myObj = new
SomeClassInDynamicallyLoadedAssembly();
foreach (ProcessModule module in
Process.GetCurrentProcess().Modules)
{
Trace.WriteLine("module: "+module.FileName);
}
}
public static int main (string [] args)
{
AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(CurrentDomain_AssemblyResolve);
Foo foo = new Foo();
}
private static Assembly CurrentDomain_AssemblyResolve(object sender,
ResolveEventArgs args)
{
// get the bytes for this assembly - wherever it might be (could be
an embedded resource)
return Assembly.Load(bytes);
}
}
I can see that the assembly is getting loaded without issue since I can
use the classes that are stored in it. But that module doesn't appear
in the current processes list of modules.
any suggestions?
Thanks,
Novice