[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Adrian Bear

11/3/2002 3:52:00 PM

Hi all,

Im having some trouble with the
System.Reflection.Assembly.GetTypes() call.

My App. stores .NET Assemblies in a Database and loads
them back up at Runtime.

Part of the App. shows the User a list of the Types
contained within the Dynamic Assembly thats about to be
saved to DB.

I cycle through the Type Array from
System.Reflection.Assembly.GetTypes() and in most cases
have no problem. But in some I receive the following
error

"One or more of the types in the assembly unable to load."
System.Reflection.Module.GetTypesInternal(StackCrawlMark&
stackMark)
at System.Reflection.Assembly.GetTypes()
at bang.Util.DbClassLibrary.fLibraryLoader.ShowAssembly
(Byte[] asmBuffer)

The Assemblies that I have tested are all perfectly
compiled released dll's. At first I thought it may be
Interfaces and Abstract Classes but they loaded fine in
another Assembly. Then I thought it might be Classes with
no Accessibly constructors but thats is not the case
either.

Does anyone have any ideas?

Adrian
1 Answer

(Kirk)

12/26/2002 7:20:00 PM

0

Adrian,

Have you tried opening your troublesome .NET assembly with Lutz
Roeder's Reflector.exe? You might find that Reflector has the same
problem.

I, too, have a troublesome .NET assembly. Reflector fails on it, as
does an application that I wrote that calls the GetTypes() method
(which throws the same exception that you noted below). The funny
thing is that another developer can run my same application on *his*
computer against my same .NET assembly, and it *succeeds* in getting a
Type array. Also, I have on *my* computer a *different* application
that calls GetTypes() against the same assembly, and *that*
application *succeeds*.

This is very strange. My co-worker and I have the same .NET Framework
version (final with SP1). It makes no sense that on my computer one of
my apps would *fail* (throw the exception) whereas another of my apps
would *succeed* and calling the GetTypes() and GetType() methods. In
contrast, my co-worker's computer *successfully* runs *both* apps
against my assembly. Very confusing!

Let me know whether Reflector has trouble with your assembly.

Has anyone else had this kind of problem? Google has some links to
postings about this exception, but nobody provides a satisfactory
solution.

Thanks.

Kirk


"Adrian Bear" <abear@bigpond.net.au> wrote in message news:<212701c28348$9995a3c0$39ef2ecf@TKMSFTNGXA08>...
> Hi all,
>
> Im having some trouble with the
> System.Reflection.Assembly.GetTypes() call.
>
> My App. stores .NET Assemblies in a Database and loads
> them back up at Runtime.
>
> Part of the App. shows the User a list of the Types
> contained within the Dynamic Assembly thats about to be
> saved to DB.
>
> I cycle through the Type Array from
> System.Reflection.Assembly.GetTypes() and in most cases
> have no problem. But in some I receive the following
> error
>
> "One or more of the types in the assembly unable to load."
> System.Reflection.Module.GetTypesInternal(StackCrawlMark&
> stackMark)
> at System.Reflection.Assembly.GetTypes()
> at bang.Util.DbClassLibrary.fLibraryLoader.ShowAssembly
> (Byte[] asmBuffer)
>
> The Assemblies that I have tested are all perfectly
> compiled released dll's. At first I thought it may be
> Interfaces and Abstract Classes but they loaded fine in
> another Assembly. Then I thought it might be Classes with
> no Accessibly constructors but thats is not the case
> either.
>
> Does anyone have any ideas?
>
> Adrian