Welcome to MSDN Blogs Sign in | Join | Help

Debugging a MissingMethodException, MissingFieldException, TypeLoadException

Say you've just installed some assemblies from a third party and now you're seeing a MissingMethodException, MissingFieldException, or TypeLoadException (during the run of an application using those assemblies). Below are the common causes.

Loading failures
First, check for assembly binding failures by getting the Fusion log. Look for the assembly containing that method/field/type or assemblies containing types referenced by it. If an assembly failed to load, use the instructions at the same link to help resolve that issue.

Unexpected assembly version loaded
But, if that's not the problem, turn on the Fusion log for everything - not just failures - and check to see if the wrong version of those assemblies is being loaded. Look at the display names requested. Are any requesting outdated versions, even after policy has been applied (see further down in the log for the post-policy display name)? If so, you may want to recompile part of your app so that it has current references.

Loaded from unexpected path
If that doesn't help, run filever.exe on the file at the path it was loaded from. You can get that from the loaded modules list in a debugger. It's also the last path listed in the Fusion log, for a successful log (if it's in the GAC, no path is listed). Make sure it is the same path as you would expect.

Not in this version of the assembly
Next, run ildasm.exe on the file at the path it was loaded from at runtime. Make sure that the method/field/type is there and is defined how you would expect it. Maybe the file has changed, adding or removing methods or the like, but the assembly version and location have stayed the same.

Invalid IL
Now, try running peverify.exe on the file containing the method/field/type using the path it was loaded from at runtime. If it gives an error, check back to see if there was a warning at compile-time for this file.

Published Friday, February 13, 2004 4:03 PM by Suzanne Cook

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Fusion binding log and fuslogvw.exe

Saturday, February 14, 2004 4:35 AM by Junfeng Zhang's .Net Framework Notes

# re: Debugging a MissingMethodException

Suzanne, nice article on MissingMethodException , it helped me debug my problem , Many thanks
Tuesday, June 01, 2004 2:19 AM by Mahavir Jain

# Where is filever?

dir c:\filever.exe /s shows nothing on my machine. I have VS.NET full install. Where do I get filever?
Thursday, June 23, 2005 4:50 PM by ryan groth

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

Hi Suzanne -

You're debugging method looks like just what I need, except that I am getting my MissingMethodException on a PocketPC application I am developing. I am trying to open a connection to a PostgreSQL database on a PC to which the PocketPC is connected using Npgsql .NET drivers for PostgreSQL.

I don't see any binding in my fusion log, because it's not running on that machine! I don'rt like my chances of porting the fusionlog viewer to PocketPC!

Any suggestions?

Cheers
Doug
Tuesday, November 29, 2005 5:32 AM by Doug Taylor

# Magerquark.de » System.TypeLoadException in C++/CLI-MFC-Anwendung

# Now I get it... Almost. Finally.

In my time working with .NET, I feel I have only scratched the surface of the multitude of APIs available

Thursday, January 25, 2007 2:34 AM by Ponderings from TheLever

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

TypeLoadException can happen when you have two projects with the same assembly name referenced... had this happen when a vendor assembly had the same name as one of my assemblies. Just thought i'd share.

Monday, February 12, 2007 2:07 PM by james peckham

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

Hi,

Your debugging method help me to diagnose my problem. But now I have question. Can I load two diffrent version of dll (eg. 1.0 and 2.0) to one process? If it is possible, how can I do it?

Best regards,

Mario

Wednesday, July 18, 2007 10:26 AM by Tholrin

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

what is the reason for the message:

"The located Assembly's manifest definitiondoes not match with the assembly reference"

and please give me a solución, thank

Thursday, January 03, 2008 6:32 PM by Novice

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

How can I catch a StackOverflowException ?

I wrote an evaluator in .NET 1.1 migrated to 2.0 and the StackOverflowException can not be caught. So user defined recursions make my application vanish off the screen without any wanings

Tuesday, August 05, 2008 5:56 AM by Avi

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

Maybe I can calculate/retrieve stack depth to prevent this error from occurring?

Thank you for your time,

Avi

Tuesday, August 05, 2008 5:57 AM by Avi

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

I am running Delphi 2005 NET (still!!) and need to download to an emulator (Windows Mobile 6 Standard) but it keeps giving a TypeLoadException. The Fusion Log doesn't seem to work with (this version of) Delphi.

Do you have any comments on how to include Fusion Log in Delphi, or another method of identifying the cause of the exception.

Regards

Friday, September 12, 2008 12:43 PM by pat

# re: Debugging a MissingMethodException, MissingFieldException, TypeLoadException

I know this post is a bit old, but thank you so much! Following your steps, I just discovered it was loading an assembly from the GAC and not the bin folder as I thought.  (I'm trying to set up a dev environment of customized software after installing a 'vanilla' version and using this discovered I have multiple versions of DLLs on the machine.)  A life saver!

Friday, February 20, 2009 3:17 PM by Jeff

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker