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 1 2387
It is not possible to load MC++ assembly through Assembly.Load(byte[]). MC++
assembly requires fixup which cannot be performed in byte array.
--
Junfeng Zhang http://blogs.msdn.com/junfeng
This posting is provided "AS IS" with no warranties, and confers no rights.
"John" <pa********@gmx.de> wrote in message
news:uG**************@TK2MSFTNGP12.phx.gbl... 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Satinderpal Singh |
last post by:
Hi All,
I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I have
not given reference to that DLL from the EXE).
Now, i call some commands of that dll from the EXE, and in...
|
by: Mirano |
last post by:
Hi everybody.
I load an assembly into another AppDomain, not a default one. As there is no
way to unload the assembly, I need to unload the domain. This is where the
app hangs.
The problem is...
|
by: Lauren Hines |
last post by:
Hello,
I have read numerous post stating that the only way to unload an assembly
(DLL in my case) is to create a separate AppDomain, load the assembly, then
unload it by calling AppDomain.Unload....
|
by: A. Elamiri |
last post by:
Hello,
I created a small app which acts as a services manager. I basically drop a
DLL in a Services folder and set the frequency through the application for
how often do I want the code in the...
|
by: Wal Turner |
last post by:
Hi there. There are various snippets on forums regarding issues with
AppDomain.Unload and how it just doesnt work.
Fortunately, I got it working with the base case, after much fiddling.
Consider...
|
by: F. Prefect |
last post by:
Hello,
(sorry for reposting this.)
We are having the following scenario:
A ASP.NET Application (C#) is using a managed C++ assembly, which is a
thin wrapper around an old C++ lib.
(We are...
|
by: Frank Uray |
last post by:
Hi all
I have a problem with loading a assembly ...
I am trying to do the following:
- I have a directory with a dll (assembly) in it (not the currect dir.)
- I am trying to load this assembly,...
|
by: illegal.prime |
last post by:
Hi all, I'm getting unexpected results when trying to preload
assemblies into an AppDomain I'm creating. Upon creation of the
AppDomain - I attach an AssemblyResolve to both my current AppDomain...
|
by: anfetienne |
last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |