Receiving the following upon call to hostContainer.ComposeParts()
:
System.ComponentModel.Composition.ChangeRejectedException was unhandled Message=The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) No valid exports were found that match the constraint '((exportDefinition.ContractName == "ModLibrary.IDataHandler") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "ModLibrary.IDataHandler".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.
Resulting in: Cannot set import 'ModAppWorks.Host.DataHandler (ContractName="ModLibrary.IDataHandler")' on part 'ModAppWorks.Host'. Element: ModAppWorks.Host.DataHandler (ContractName="ModLibrary.IDataHandler") --> ModAppWorks.Host
Source=System.ComponentModel.Composition StackTrace: at System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition atomicComposition) at System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose(CompositionBatch batch) at System.ComponentModel.Composition.Hosting.CompositionContainer.Compose(CompositionBatch batch) at System.ComponentModel.Composition.AttributedModelServices.ComposeParts(CompositionContainer container, Object[] attributedParts) at ModAppWorks.Host.Compose() in C:\Projects\ModAppWorks_2\HostProgram.cs:line 83 at ModAppWorks.Host.Run() in C:\Projects\ModAppWorks_2\HostProgram.cs:line 49 at ModAppWorks.Program.Main() in C:\Projects\ModAppWorks_2\HostProgram.cs:line 25 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
Import snippet:
[Import(typeof(IDataHandler))]
public Lazy<IDataHandler> DataHandler { get; set; }
However, the DataHandler is defined as such:
[Export(typeof(IDataHandler))]
public class DataAgent : DataProvider<SqlConnection, SqlDataReader>, IDataHandler
{
// contains an empty public ctor passing ctor parameters to DataProvider
}
DataProvider is an abstract class that also inherits IDataHandler and actually implements the IDataHandler interface. Also, builds are written directly to an \Extensions directory for the Host app.
Any suggestions as to what I am doing wrong?