How a Stupid Mistake Resulted in a System.TypeLoadException

A few weeks ago, I had a rather strange problem. Between two meetings I thought I could quickly write a little code example. While it compiled without error, I got this exception when I tried to run in:

Unhandled Exception: System.TypeLoadException: Could not load type ‘MetadataExtractor.ImageMetadataReader’ from assembly ‘MetaDataExtractor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’.
at MetaDataExtractor.Program.Main(String[] args)

I could google as much as I wanted, this kind of error did not result in any helpful advice. I checked and rechecked, but it stayed the same. I even went back to an older sample and copied code over – always ending in a System.TypeLoadException.

It took me far too long to notice my error: I gave my project the same name as the library I wanted to use for my code sample. As soon as I changed the assembly name to something else (in the project properties), I could run my sample without exception.


Those little mistakes are annoying and can take endless time to fix. I hope this post will give you an idea on what to look for should you run into the same exception.

3 thoughts on “How a Stupid Mistake Resulted in a System.TypeLoadException”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.