locked
Inconsistent ReflectionTypeLoadException during MEF composition RRS feed

  • Question

  • I have the following code to load exported DLL's to my container.

    DirectoryCatalog catalog = new DirectoryCatalog(@"D:\Helpers");

    This works fine from a windows application and constructs the parts successfully.

    But when I use the same folder to construct in my WCF service it throws type load exception. It gives LoaderException as "Method 'XXX' in type 'XXX' from assembly 'XXX' does not have implementation".  (Find below the error snapshot)

    Though I can write a custom code to ignore/exclude the 'bad' assemblies, I would like to understand why the same piece of code should work in one place and not in other. I have tested this side by side and this is happening every time.

    BTW, both the projects are in .Net framework 4.0 referencing the same MEF libraries. Both the app domain references are almost the same and have only this piece of code.

    Need help in understanding this.

    Thanks!

    Sridhar

    Sunday, September 9, 2012 6:37 AM