Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

TypeLoadException

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kartik.vad@gmail.com - 19 Feb 2006 17:42 GMT
I try to run an executable (test.exe) that depends on an assembly
(AdderNamespace.dll) which exists in the same directory, and I get the
following exception:

Unhandled Exception: System.TypeLoadException: Could not load type
'AdderNamespace.Container' from assembly 'AdderNamespace,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
  at AdderNamespace.Factory.New()
  at addertest.Class1.Main()

ILDASM reports that the offending type AdderNamespace.Container indeed
exists. It's public. I have full access to the assembly file, and the
version number of the file matches the one in the error message.

Some of the DLLs the executable (indirectly) depends on have probably
been built with .NET 2 beta, and I'm now using the release version. I
also have 1.1 installed, though I think 2.0 is the one being used (I
notice disk accesses to \WINDOWS\Microsoft.NET\Framework\v2.0.50727
rather than the folder for 1.1)

What could have gone wrong, and how do I fix it? Thank you.
kartik.vad@gmail.com - 19 Feb 2006 18:11 GMT
I got it solved! It turned out that a dependent DLL was missing and the
CLR's message did not say Assembly Not Found but: Could not load type
from existing assembly". (I seem to get a message of the former kind
when an assembly that the executable directly depends on is missing,
but not if it indirectly depends on the missing assembly.)

I got this info from:
http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspx

Sorry for the premature posting. But I wonder: if the CLR can't find an
assembly, why doesn't it say so?
Jon Skeet [C# MVP] - 19 Feb 2006 18:28 GMT
> I got it solved! It turned out that a dependent DLL was missing and the
> CLR's message did not say Assembly Not Found but: Could not load type
[quoted text clipped - 7 lines]
> Sorry for the premature posting. But I wonder: if the CLR can't find an
> assembly, why doesn't it say so?

Did you look at the inner exception of the original TypeLoadException?
That might have had more information.

(For what it's worth, I've just tried to reproduce the problem, and not
managed it - I suspect it needs to be a bit more involved than my
little sample code :)

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

kartik.vad@gmail.com - 01 Mar 2006 13:27 GMT
> Did you look at the inner exception of the original TypeLoadException?
No - I didn't know there was an inner exception because there was no
mention of it in the stack trace. Why doesn't the CLR print out this
information (like the JVM does)?
Jon Skeet [C# MVP] - 19 Feb 2006 18:22 GMT
> I try to run an executable (test.exe) that depends on an assembly
> (AdderNamespace.dll) which exists in the same directory, and I get the
[quoted text clipped - 17 lines]
>
> What could have gone wrong, and how do I fix it? Thank you.

I suspect the problem is that it can't load the AdderNamespace assembly
because it depends on beta assemblies which are no longer available.

Rebuild all the assemblies which refer to beta assemblies, and I expect
the problem will go away.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.