Problem with ExportFactory

Sep 29, 2010 at 1:44 PM

Hi everybody,

I'm trying MEF 2 Preview 1 but when I try to use ExportFactory (desktop app) I get this strange exception


The runtime has encountered a fatal error. The address of the error was at 0x670dac23, on thread 0x1bc0. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Below the code I've used

    public class App
        private CompositionContainer _container;
        private AssemblyCatalog _assemblyCatalog;

        public App()
            _assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            _container = new CompositionContainer(_assemblyCatalog);


        public ExportFactory<Plugin> Plugin { get; set; }

    public class Plugin
        public Plugin()
            this.Name = "Plugin1";

        public string Name { get; set; }

Any idea?


Sep 29, 2010 at 8:31 PM

Off the top of my head I have no idea but out of curiousity what type of application are you using here? Is it a console app or a WPF app?

Sep 29, 2010 at 10:33 PM

A console application!

I’ve ran the ExportFactory tests and I haven’t any problems L



Sep 30, 2010 at 5:10 PM

I tried to reproduce here but it worked just fine