Hi,
I tried to load a mixedmode dll (MC++) with AppDomain.Load( Byte[] ) in a C#
Client.
During the Load Process I got the following Exception:
System.IO.FileL oadException: Ausnahme von HRESULT: 0x80131019.
at System.Reflecti on.Assembly.nLo adImage(Byte[] rawAssembly, Byte[]
rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark)
at System.AppDomai n.Load(Byte[] rawAssembly) ...
I also tried this with a pure managed MC++ dll and got the same error.
If I load a normal C# dll everythink is fine.
Here's the code loading the Assembly:
Any Suggestions?
////////////////////////Code Snippet for Loading the Assembly
public void LoadAssemblyOnl y(string Path)
{
FileStream f1 = new FileStream(Path ,FileMode.Open) ;
Byte[] rawAssemblyByte s1 = new Byte[f1.Length];
f1.Read(rawAsse mblyBytes1,0,(i nt)f1.Length);
f1.Close();
AppDomain.Curre ntDomain.Assemb lyResolve +=new
ResolveEventHan dler(CurrentDom ain_AssemblyRes olve0);
Assembly ass = AppDomain.Curre ntDomain.Load(r awAssemblyBytes 1);
MessageBox.Show (ass.FullName," Loaded AssemblyName");
string AssList="";
foreach (Assembly a in AppDomain.Curre ntDomain.GetAss emblies() )
{
AssList += a.FullName +"\r\n";
}
MessageBox.Show (AssList,"Assem blyList");
string typelist="";
foreach(Type t in ass.GetTypes() )
{
typelist += t.FullName +"\r\n";
}
MessageBox.Show (typelist,"Type LIst");
}
private Assembly CurrentDomain_A ssemblyResolve0 (object sender,
ResolveEventArg s args)
{
MessageBox.Show ("Name:"+args.N ame,"ResolveEve nt") ;
Assembly ass = Assembly.LoadFr om(args.Name);
if(ass!=null)
{
MessageBox.Show ("Assembly loaded:"+ass.Fu llName);
}
else
{
MessageBox.Show ("Assembly not loaded");
}
return ass;
}
////////////////////////
Best regards in advance
John
I tried to load a mixedmode dll (MC++) with AppDomain.Load( Byte[] ) in a C#
Client.
During the Load Process I got the following Exception:
System.IO.FileL oadException: Ausnahme von HRESULT: 0x80131019.
at System.Reflecti on.Assembly.nLo adImage(Byte[] rawAssembly, Byte[]
rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark)
at System.AppDomai n.Load(Byte[] rawAssembly) ...
I also tried this with a pure managed MC++ dll and got the same error.
If I load a normal C# dll everythink is fine.
Here's the code loading the Assembly:
Any Suggestions?
////////////////////////Code Snippet for Loading the Assembly
public void LoadAssemblyOnl y(string Path)
{
FileStream f1 = new FileStream(Path ,FileMode.Open) ;
Byte[] rawAssemblyByte s1 = new Byte[f1.Length];
f1.Read(rawAsse mblyBytes1,0,(i nt)f1.Length);
f1.Close();
AppDomain.Curre ntDomain.Assemb lyResolve +=new
ResolveEventHan dler(CurrentDom ain_AssemblyRes olve0);
Assembly ass = AppDomain.Curre ntDomain.Load(r awAssemblyBytes 1);
MessageBox.Show (ass.FullName," Loaded AssemblyName");
string AssList="";
foreach (Assembly a in AppDomain.Curre ntDomain.GetAss emblies() )
{
AssList += a.FullName +"\r\n";
}
MessageBox.Show (AssList,"Assem blyList");
string typelist="";
foreach(Type t in ass.GetTypes() )
{
typelist += t.FullName +"\r\n";
}
MessageBox.Show (typelist,"Type LIst");
}
private Assembly CurrentDomain_A ssemblyResolve0 (object sender,
ResolveEventArg s args)
{
MessageBox.Show ("Name:"+args.N ame,"ResolveEve nt") ;
Assembly ass = Assembly.LoadFr om(args.Name);
if(ass!=null)
{
MessageBox.Show ("Assembly loaded:"+ass.Fu llName);
}
else
{
MessageBox.Show ("Assembly not loaded");
}
return ass;
}
////////////////////////
Best regards in advance
John
Comment