473,569 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReflectionTypeL oadException diagnosis?

Hi,
I'm trying to load a list of types from a dynamically
loaded assembly, e.g:

Assembly a = Assembly.LoadFr om(path);
a.ModuleResolve += new ModuleResolveEv entHandler
(OnAssemblyModu leResolve);
types = a.GetTypes();

ReflectionTypeL oadException gets thrown on the second
line:
System.Reflecti on.ReflectionTy peLoadException : One or
more of the types in the assembly unable to load.

I'm trying to work out exactly why. If I listen to the
ModuleResolve assembly event as well as the current
AppDomain's AssemblyResolve and TypeResolve events,
nothing fires - I would of expected one of them to. The
exception instance isn't very helpful either, it just
lists the types that *were* loaded, not the one(s) that
caused the problem. I've tried using the binding log
viewer, but it reports nothing, and I've also tried using
the Assembly.LoadFi le() method instead of LoadFrom.

The current AppDomain's RelSearchPath and BasePath both
seem to be right (RelSearchPath includes the directory of
the assembly being loaded, and BasePath includes library
assemblies that the loaded assembly requires). No
assemblies (besides the FX) are in the GAC, nor do I want
them to be.

How do I work out what's going wrong here?? Why don't the
Module/Type resolve failure events fire?
Nov 15 '05 #1
1 5559
I am experiencing a similar issue that doesn't seem to be addressed in
any of the related posts to this newsgroup. I am guessing that your
exception is being thrown on the first line (the "LoadFrom")- this is
identical to the issue I am having trying to load types dynamically
from an assembly DLL file.

When I am in Visual Studio .NET, I have no problem clicking
"Project... Add Reference...", then browsing to the DLL and adding a
reference to my project. This adds all types from the assembly to my
project as expected, and I can verify this by looking at the object
viewer.

I think there is a difference between the way Assembly.LoadFr om(...)
works and the mechanism being used in Visual Studio .NET. The best I
can gather is that an assembly with DLL dependencies cannot be loaded
because those dependency DLLs cannot be found. Maybe
Assembly.LoadFr om(...) doesn't use the system path, where Visual
Studio .NET searches the system path or registered components to find
all the dependencies.

If you have DLL dependencies, try copying them to the same directory
as your assembly DLL/EXE and rerunning the code snippet- this may
solve your problem. If anyone from Microsoft is reading this, can you
attempt to actually respond to this issue and not ignore it? Is this a
problem with the Assembly class or what? I haven't seen a satisfactory
solution posted yet and my experience is Microsoft Inc is slow to
admit to mistakes or errors in their codebase.


<an*******@disc ussions.microso ft.com> wrote in message news:<06******* *************** ******@phx.gbl> ...
Hi,
I'm trying to load a list of types from a dynamically
loaded assembly, e.g:

Assembly a = Assembly.LoadFr om(path);
a.ModuleResolve += new ModuleResolveEv entHandler
(OnAssemblyModu leResolve);
types = a.GetTypes();

ReflectionTypeL oadException gets thrown on the second
line:
System.Reflecti on.ReflectionTy peLoadException : One or
more of the types in the assembly unable to load.

I'm trying to work out exactly why. If I listen to the
ModuleResolve assembly event as well as the current
AppDomain's AssemblyResolve and TypeResolve events,
nothing fires - I would of expected one of them to. The
exception instance isn't very helpful either, it just
lists the types that *were* loaded, not the one(s) that
caused the problem. I've tried using the binding log
viewer, but it reports nothing, and I've also tried using
the Assembly.LoadFi le() method instead of LoadFrom.

The current AppDomain's RelSearchPath and BasePath both
seem to be right (RelSearchPath includes the directory of
the assembly being loaded, and BasePath includes library
assemblies that the loaded assembly requires). No
assemblies (besides the FX) are in the GAC, nor do I want
them to be.

How do I work out what's going wrong here?? Why don't the
Module/Type resolve failure events fire?

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1854
by: Ringo | last post by:
Medical Diagnosis: Possession Trance Physicians Diagnosis Manual: DSM IV, section 300.14, pp 486-487, and i quote, "the diagnosis of dissociative identity disorder takes precedence over dissociative amnesia, dissociative fugue, and depersonalization disorder. individuals with dissociative identity disorder can be distinguished from those...
0
1262
by: Ed | last post by:
Hi, I have to install a service in my PC which has been developed by my company. While installation the System.Reflection.ReflectionTypeLoadException exception is thrown. And the log is as follows - **********XXXX.installlog starts******************************* Installing assembly 'c:\program files\audiosoft\service\XXXX.exe'. Affected...
1
5548
by: Bob | last post by:
I created a windows service and added an installer by following the tutorial in MSDN. But when I run the installutil.exe tool I get an error. Below is the log. Installing assembly 'c:\temp\serv\prorec.exe'. Affected parameters are: assemblypath = c:\temp\serv\prorec.exe logfile = c:\temp\serv\prorec.InstallLog An exception occurred while...
2
4370
by: Joe Weinstein | last post by:
Hi, and thanks in advance... I have about zero experience with DB2, and I need help diagnosing a transaction-related problem... What SQL can I run to find what transactions (XA) may be in process in the DBMS, and which(or how many) dynamic sections may be associated with a given open transaction? The problem presents itself as a client...
5
2073
by: Matt. | last post by:
Hi all! This has happened to two different databases to me in two days. A query which has been working flawlessly for over 9 months suddenly won't run because the "ISNULL" function is undefined. Compact and Repair - no problems. JetComp utility - no problems. Then I try to edit a module, and the VB editor won't let me make any
1
2998
by: Andrew S. Giles | last post by:
We just converted our Visual Studio 7.1 development projects to Visual Studio 8.0 (2005). I am working on a form, and I want to add one of the custom controls that we had developed under 7.1 (2003) and stored in its own project. When I attempt to add this control (drag and drop) I get the above error. I am trying to figgure out how to...
1
1234
by: | last post by:
I have made a web application that is giving me an error in loading assemblies. It reports file not found (error message below). I know I have the .dll in the .bin directory for the application.: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following...
3
3284
by: Bob | last post by:
Hi, I have an app that has a 3rd party phone answering control (4 of ) (interfacing with dialogic 4 line card) attached to the main form. each control raises an event when its Dialogic line detects ring tone. I use the ring detect event handler to create a new thread which is given a reference to the control that is being rung. The called...
3
1363
by: SteveB | last post by:
Hello All We have an app that was written a few years ago in which the developers wrote an entire exception handling system. I have a problem with the following line if code:
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.