1

Closed

Dropping a dll containing one export and refreshing catalog results in 2 exports

description

Hello,

I have a shared dll containing an interface and another dll that implements it as follows :

public interface IPricer
{
void Send(string type, string data);
}

[Export(typeof(IPricer))]
[ExportMetadata("InstrumentType", "EQUITY")]
public class Pricer : IPricer
{
public void Send(string type, string data)
{
System.Console.WriteLine(string.Format(CultureInfo.CurrentCulture, "Type={0} Data={1}", type, data));
}
}

After dropping the implementation dll into my plugin folder and doing a DirectoryCatalog.Refresh(), I iterate through the ExportsChangeEventArgs.AddedExports (supplied by the ExportsChanged event handler) and find two exports instead of one with the following contract names :

[NamespaceGoesHere]IPricer
System.ComponentModel.Composition.Contracts.ExportFactory

The first export, IPricer, is what I expect; the second export is killing me; what is this thing and where did it come from? The implementation dll contains nothing but the Pricer code I posted above and my plugin folder contains nothing but that one dll. Is this a bug or am I missing something?

Many thanks,

Anthony

No files are attached

Closed Mar 2 at 4:36 PM by nblumhardt
By design.

comments

nblumhardt wrote Feb 8 at 8:59 PM

Hi,

This is part of the infrastructure for ExportFactory<T>, a new feature recently added to MEF:

• http://blogs.msdn.com/b/bclteam/archive/2011/11/17/exportfactory-amp-lt-t-amp-gt-in-mef-2-alok.aspx

Cheers,
Nick