Joe
Joe

Reputation: 428

C# Classes from Module could not be loaded

I'm getting an internal compiler error:

System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

What would make them not load? The error offers no help and MSDN tell you about the class throwing when they can't be loaded, not why they wouldn't be able to be loaded.

There is literally no information on what would prevent classes from being loaded that I can find, help me out?

Edit: It doesn't actually tell me at which line the exception is thrown. Not all classes are public, some are internal, but the classes that need to be exposed in order for the system to work are public (no classes other than public are used in the calling code). The DLL was compiled in VS13, and the quick console application I made alongside that in VS for testing works fine - it recognises the namespace from the DLL, and makes use of the public classes available. When I bring the DLL out of a release build and into the program I'm using it with, however, that is when I run into this error.

Upvotes: 3

Views: 2500

Answers (1)

Joe
Joe

Reputation: 428

It looks like a simple mistake: the target platform for using the DLL with is constantly updated, and does not specify a .NET version; one normally assumes this means that it uses 'up-to-date'. Oh no, rolling back through build targets for the DLL finally yielded a working DLL. Will post this to the author of the program as a request; it helps if you know what you're working with!

TL;DR: Wrong target version of .NET, changing to 3.0 allowed the DLL to work, with no complaining.

Upvotes: 1

Related Questions