Differences between AssemblyCatalog overloaded constructors

Feb 16, 2011 at 2:49 PM

I've been using the AssemblyCatalog(string) constructor in my project without experiencing problems -- until the day I ran it on a German OS with a German VS installed (my MEF thing is part of a VSPackage).

On that day, MEF loaded one (1) type instead of the expected three (3). After much fiddling about I finally tried the AssemblyCatalog(Assebly) constructor instead:

     Assembly codeBase = Assembly.LoadFrom(assemblyPath);
     using (AssemblyCatalog assemblyCatalog = new AssemblyCatalog(codeBase))
     { ... }

Lo and behold, all my types were loaded.

Even though I don't have a problem any longer, I'm mightily curious about this -- can anyone shine a light on it?

I'm using the official .NET version, BTW.


Feb 16, 2011 at 6:07 PM

I've asked internally and David Kean (our dev) reply was


He’s loading in a different context. AssemblyCatalog that takes a string tries the Load context first, followed by the LoadFrom. He’s changed the code to always use the LoadFrom context.


As to why he’s seeing a difference on a German OS, without debugging it I can’t say.

Feb 16, 2011 at 8:00 PM

Thanks for responding; good to know there's a difference at least. Possibly one that belongs in the remarks of the API docs -- load context issues are tricky and not exactly mainstream.

Anyways, I have one or two experiments I want to try; I'll post anything interesting here. (I'd understand a total failure better than a partial failure at this point, so I'll persue this for a bit even though the problem is "solved" for the moment. As long as it's not understood, it's not solved.)