Stable Composition Diagnostics

Aug 9, 2009 at 4:55 AM

I'm having a lot of trouble working through issues to even get a dump I can analyze:

- The sample diagnostics compiles to x86, not Any CPU. As this corresponds to a lot of people switching to Win 7 and 64 bit development, I think this will trip a bunch of people up

- The Part Info does not accept a string (apparently). Since the type is not available in the context of the container, this doesn't help as much as it could. Please add a string overload if possible

- The full information does not fit in the buffer of my command window. The current syntax makes it fairly awkward to just retrieve as a string and display in the command window, which I think people are more likely to want to do, espicially when it overruns the command window.

- The debug visualizer does not include the name of the target type even a couple of layers deep. This makes it pretty much useless.

I was able through trial and error find the part I think is in the system (below) and its export definition, which has the interface I expect (there are four statements from teh debug window below, the exception, the composition info for the part by trial and error, and the composition info for the part def and the parts export definition). I do not see why this part isn't found on composition.

Thanks for any help you can give.

This is definitely the challenge for stable composition.

Kathleen

? ex

{"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.\r\n\r\n1) No exports were found that match the constraint '((exportDefinition.ContractName = \"AppVenture.Common.IOutputService\") && (exportDefinition.Metadata.ContainsKey(\"ExportTypeIdentity\") && \"AppVenture.Common.IOutputService\".Equals(exportDefinition.Metadata.get_Item(\"ExportTypeIdentity\"))))'.\r\n\r\nResulting in: Cannot set import 'AppVenture.TemplateHarness.TemplateHarness._outputService (ContractName=\"AppVenture.Common.IOutputService\")' on part 'AppVenture.TemplateHarness.TemplateHarness'.\r\nElement: AppVenture.TemplateHarness.TemplateHarness._outputService (ContractName=\"AppVenture.Common.IOutputService\") --> AppVenture.TemplateHarness.TemplateHarness\r\n"}

[System.ComponentModel.Composition.ChangeRejectedException]: {"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.\r\n\r\n1) No exports were found that match the constraint '((exportDefinition.ContractName = \"AppVenture.Common.IOutputService\") && (exportDefinition.Metadata.ContainsKey(\"ExportTypeIdentity\") && \"AppVenture.Common.IOutputService\".Equals(exportDefinition.Metadata.get_Item(\"ExportTypeIdentity\"))))'.\r\n\r\nResulting in: Cannot set import 'AppVenture.TemplateHarness.TemplateHarness._outputService (ContractName=\"AppVenture.Common.IOutputService\")' on part 'AppVenture.TemplateHarness.TemplateHarness'.\r\nElement: AppVenture.TemplateHarness.TemplateHarness._outputService (ContractName=\"AppVenture.Common.IOutputService\") --> AppVenture.TemplateHarness.TemplateHarness\r\n"}

Data: {System.Collections.ListDictionaryInternal}

HelpLink: null

HResult: -2146233088

InnerException: null

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.\r\n\r\n1) No exports were found that match the constraint '((exportDefinition.ContractName = \"AppVenture.Common.IOutputService\") && (exportDefinition.Metadata.ContainsKey(\"ExportTypeIdentity\") && \"AppVenture.Common.IOutputService\".Equals(exportDefinition.Metadata.get_Item(\"ExportTypeIdentity\"))))'.\r\n\r\nResulting in: Cannot set import 'AppVenture.TemplateHarness.TemplateHarness._outputService (ContractName=\"AppVenture.Common.IOutputService\")' on part 'AppVenture.TemplateHarness.TemplateHarness'.\r\nElement: AppVenture.TemplateHarness.TemplateHarness._outputService (ContractName=\"AppVenture.Common.IOutputService\") --> AppVenture.TemplateHarness.TemplateHarness\r\n"

Source: "System.ComponentModel.Composition"

StackTrace: " at System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition atomicComposition) in c:\\Users\\Kathleen\\Downloads\\MEF_Preview_6\\MEF_Preview_6\\src\\ComponentModel\\System\\ComponentModel\\Composition\\CompositionResult.cs:line 84\r\n at System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose(CompositionBatch batch) in c:\\Users\\Kathleen\\Downloads\\MEF_Preview_6\\MEF_Preview_6\\src\\ComponentModel\\System\\ComponentModel\\Composition\\Hosting\\ComposablePartExportProvider.cs:line 245\r\n at System.ComponentModel.Composition.Hosting.CompositionContainer.Compose(CompositionBatch batch) in c:\\Users\\Kathleen\\Downloads\\MEF_Preview_6\\MEF_Preview_6\\src\\ComponentModel\\System\\ComponentModel\\Composition\\Hosting\\CompositionContainer.cs:line 202\r\n at AppVenture.Common.ExportingCompositionContainer.Compose() in C:\\Users\\Kathleen\\Current Projects\\CodeGen\\AppVentureCommunityGenerator 2008 MEF 6\\T4Host\\Source\\CommonSupport\\Com

mon\\ExportingCompositionContainer.cs:line 367"

TargetSite: {Void ThrowOnErrors(System.ComponentModel.Composition.Hosting.AtomicComposition)}

 

 

? ci.PartDefinitions.ToArray()[39]

{Microsoft.ComponentModel.Composition.Diagnostics.PartDefinitionInfo}

_isRejected: {System.Lazy<bool>}

BrokenNonRejectedImports: {System.Linq.Enumerable.WhereEnumerableIterator<Microsoft.ComponentModel.Composition.Diagnostics.ImportDefinitionInfo>}

ImportDefinitions: {System.Linq.Enumerable.WhereSelectArrayIterator<System.ComponentModel.Composition.Primitives.ImportDefinition,Microsoft.ComponentModel.Composition.Diagnostics.ImportDefinitionInfo>}

IsPrimaryRejection: false

IsRejected: false

MaximumAnalysisDepth: 20

PartDefinition: {AppVenture.DefaultOutputServices.OutputAgregatingService}

PossibleRootCauses: {Microsoft.ComponentModel.Composition.Diagnostics.PartDefinitionInfo[0]}

<font size="1">

 

</font>

 

? ci.PartDefinitions.ToArray()[39].PartDefinition

 

 

 

 

{AppVenture.DefaultOutputServices.OutputAgregatingService}

[System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition]: {AppVenture.DefaultOutputServices.OutputAgregatingService}

ExportDefinitions: {System.ComponentModel.Composition.Primitives.ExportDefinition[1]}

ImportDefinitions: {System.ComponentModel.Composition.Primitives.ImportDefinition[1]}

Metadata: Count = 0

 

? ci.PartDefinitions.ToArray()[39].PartDefinition.ExportDefinitions.First()

{AppVenture.DefaultOutputServices.OutputAgregatingService (ContractName="AppVenture.Common.IOutputService")}

[System.ComponentModel.Composition.ReflectionModel.ReflectionMemberExportDefinition]: {AppVenture.DefaultOutputServices.OutputAgregatingService (ContractName="AppVenture.Common.IOutputService")}

_contractName: null

_metadata: Count = 0

ContractName: "AppVenture.Common.IOutputService"

Metadata: Count = 3

 

 

Aug 9, 2009 at 5:10 AM

Follow-up:

I think I solved this, but I still don't see where in the above I could see that the IOutputService part was not composed because of an internal failure. The failure was due to this:

[Import]private IEnumerable<Lazy<IOutputListener>> mListenerExports = null;

I had failed to update this Import to ImportMany.

I found this by examing the class, which happily was relatively simple. But I just had to see the problem, I did not retrieve it from diagnostics.

Just letting you know because I think this diagnostics is an important piece, and it didn't seem to help me in this case - maybe I'm looking at the wrong things.

 

Kathleen

Aug 11, 2009 at 7:56 PM

Hi Kathleen,

Sorry I missed this - I don't know how it slipped by me. I'll try to address the issues you've raised, thanks for pointing them out.

Nick

Aug 12, 2009 at 10:34 PM

J

I know your working on that diagnostic pattern, but I figure feedback is good.

From: nblumhardt [mailto:notifications@codeplex.com]
Sent: Tuesday, August 11, 2009 1:57 PM
To: kathleen@mvps.org
Subject: Re: Stable Composition Diagnostics [MEF:64949]

From: nblumhardt

Hi Kathleen,

Sorry I missed this - I don't know how it slipped by me. I'll try to address the issues you've raised, thanks for pointing them out.

Nick

Read the full discussion online.

To add a post to this discussion, reply to this email (MEF@discussions.codeplex.com)

To start a new discussion for this project, email MEF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com