This project has moved and is read-only. For the latest updates, please go here.

ExportFactory FatalExecutionEngineError with Open Generic Type Parameter

Sep 23, 2011 at 4:12 PM

There would seem to be a pretty serious problem when using a Type Parameter from a Generic Type in ExportFactory<T>, namely a ExcecutionEngineException (I could be wrong but I suspect there is a bigger problem at play here if MEF can cause the CLR to choke).

Simply having the following class:

public interface IOpenGeneric3<T> { }

public class OpenGeneric3<T> : IOpenGeneric3<T>
    public OpenGeneric3(ExportFactory<T> import)

declared and registered in the container causes any attempt to get an export (even if the export is completely unrelated to the above class) from the container to throw a FatalExecutionEngineError. The ExportFactory appears to work fine with the use of a specified type, but crashes as soon as there is a Type Parameter involved.


Sep 23, 2011 at 6:46 PM
Edited Sep 23, 2011 at 6:47 PM

While doing further investigation I've discovered that this problem appears to have been resolved in the .NET 4.5 Developer Preview. It would be nice if there was a preview release that didn't require installing .NET 4.5, ripping the assembly out of the references directory and then specifying hint paths for every project in my solution to point to the version I need.