Error while doing GetComponentParts in MEF

Apr 18, 2011 at 7:40 AM

While doing GetComponentParts I am getting following error, to be specific it reporoduces while i do import in continuous loop while handling multiple messages in my WCF application

  • The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
  • 1) The composition failed because it did not complete within '100' iterations. This is most likely caused by a cycle in the dependency graph of a part which is marked with a non-shared creation policy.

One more thing I cant locate CompositionException.Errors to find the root cause.

Please suggest what workaround possible, as i am not getting a single thread on the net suggesting any way...

Many Thanks

May 5, 2011 at 1:46 PM

Add me to that. Same problem. Happens sometimes, mostly on more powerfull machines. This looks like a threading problem to me - the GC taking the data off while it is being processed.

My relevant stack trace is:

   at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()   at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)   at System.Lazy`1.CreateValue()   at System.Lazy`1.LazyInitValue()

and it runs on a 24 core server machine with server gc - which is why i think it may be a threading issue.

Apr 14, 2012 at 1:51 PM

I know this is an old thread but I'm seeing the same thing when one of our service's is heavily loaded. It is executing the same code while receiving messages via wcf. The system will run fine but after a while I'll start to see the above errors creeping in, the longer we run, the more errors I start to see.

This project has the MefContrib unity-mef integration enabled, the object that creation is failing on has no mef imports, just constructor parameter injection via unity.

Just wondering if anyone had any ideas?

  Resolving GT.Sateon.ESS.Core.Repositories.StreamRepository,(none) (mapped from GT.Sateon.ESS.Core.Repositories.IStreamRepository, (none))
 ---> System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. R
eview the CompositionException.Errors property for more detailed information.

1) The composition failed because it did not complete within '100' iterations. This is most likely caused by a cycle in the dependency graph of a part
 which is marked with a non-shared creation policy.

   at System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(ComposablePart part)
   at System.ComponentModel.Composition.Hosting.CompositionContainer.SatisfyImportsOnce(ComposablePart part)
   at System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOnce(ICompositionService compositionService, Object attributedPart)
   at MefContrib.Integration.Unity.Strategies.ComposeStrategy.PostBuildUp(IBuilderContext context) in D:\Devwork\tmp\MefContrib-MefContrib-v1.1.0.0-63
-g8ad5b6f\MefContrib-MefContrib-8ad5b6f\src\MefContrib.Integration.Unity\Strategies\ComposeStrategy.cs:line 28
   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in c:\EntLib\UnityTemp\Compile\Unity\Unity\Src\ObjectBu
ilder\Strategies\StrategyChain.cs:line 110
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) in c:\EntLib\UnityTemp
\Compile\Unity\Unity\Src\UnityContainer.cs:line 512
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) in c:\EntLib\UnityTemp
\Compile\Unity\Unity\Src\UnityContainer.cs:line 516
   at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) in c:\EntLib\UnityTemp\Compile\Unity
\Unity\Src\UnityContainer.cs:line 173
   at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container, String name, ResolverOverride[] overrides) in c:\EntLib
\UnityTemp\Compile\Unity\Unity\Src\UnityContainerExtensions.cs:line 518
   at Microsoft.Practices.ObjectBuilder2.DeferredResolveBuildPlanPolicy.ResolveTrampoline`1.Resolve() in c:\EntLib\UnityTemp\Compile\Unity\Unity\Src\O
bjectBuilder\Strategies\BuildPlan\Factory\DeferredResolveBuildPlanPolicy.cs:line 99
   at GT.Sateon.ESS.Core.Subscriptions.MsmqRelayChannel.DrainQueue() in c:\devwork\stephen\gt-dev\SATEON\dev\source\EventStreamService\GT.Sateon.ESS.C
ore\Subscriptions\StreamChannels\MsmqRelayChannel.cs:line 127