J
John
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.FileLoadException: Ausnahme von HRESULT: 0x80131019.
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[]
rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark)
at System.AppDomain.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 LoadAssemblyOnly(string Path)
{
FileStream f1 = new FileStream(Path ,FileMode.Open);
Byte[] rawAssemblyBytes1 = new Byte[f1.Length];
f1.Read(rawAssemblyBytes1,0,(int)f1.Length);
f1.Close();
AppDomain.CurrentDomain.AssemblyResolve +=new
ResolveEventHandler(CurrentDomain_AssemblyResolve0);
Assembly ass = AppDomain.CurrentDomain.Load(rawAssemblyBytes1);
MessageBox.Show (ass.FullName,"Loaded AssemblyName");
string AssList="";
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies() )
{
AssList += a.FullName +"\r\n";
}
MessageBox.Show(AssList,"AssemblyList");
string typelist="";
foreach(Type t in ass.GetTypes() )
{
typelist += t.FullName +"\r\n";
}
MessageBox.Show(typelist,"TypeLIst");
}
private Assembly CurrentDomain_AssemblyResolve0(object sender,
ResolveEventArgs args)
{
MessageBox.Show ("Name:"+args.Name,"ResolveEvent") ;
Assembly ass = Assembly.LoadFrom(args.Name);
if(ass!=null)
{
MessageBox.Show ("Assembly loaded:"+ass.FullName);
}
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.FileLoadException: Ausnahme von HRESULT: 0x80131019.
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[]
rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark)
at System.AppDomain.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 LoadAssemblyOnly(string Path)
{
FileStream f1 = new FileStream(Path ,FileMode.Open);
Byte[] rawAssemblyBytes1 = new Byte[f1.Length];
f1.Read(rawAssemblyBytes1,0,(int)f1.Length);
f1.Close();
AppDomain.CurrentDomain.AssemblyResolve +=new
ResolveEventHandler(CurrentDomain_AssemblyResolve0);
Assembly ass = AppDomain.CurrentDomain.Load(rawAssemblyBytes1);
MessageBox.Show (ass.FullName,"Loaded AssemblyName");
string AssList="";
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies() )
{
AssList += a.FullName +"\r\n";
}
MessageBox.Show(AssList,"AssemblyList");
string typelist="";
foreach(Type t in ass.GetTypes() )
{
typelist += t.FullName +"\r\n";
}
MessageBox.Show(typelist,"TypeLIst");
}
private Assembly CurrentDomain_AssemblyResolve0(object sender,
ResolveEventArgs args)
{
MessageBox.Show ("Name:"+args.Name,"ResolveEvent") ;
Assembly ass = Assembly.LoadFrom(args.Name);
if(ass!=null)
{
MessageBox.Show ("Assembly loaded:"+ass.FullName);
}
else
{
MessageBox.Show ("Assembly not loaded");
}
return ass;
}
////////////////////////
Best regards in advance
John