Getting the following error occasionally
ProcessEntry() failed. InvalidOperationException: AtomicComposition encountered an unexpected Exception, review InnerException for details.
Stack Trace:
at System.ComponentModel.Composition.Hosting.AtomicComposition.FinalComplete()
at System.ComponentModel.Composition.Hosting.AtomicComposition.Complete()
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.DetermineRejection(ComposablePartDefinition definition, AtomicComposition parentAtomicComposition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.IsRejected(ComposablePartDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InnerCatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValueCore[T](String contractName, ImportCardinality cardinality)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValue[T](String contractName)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValue[T]()
--------------------------Inner Exception--------------------------
AggregateException: One or more errors occurred.
NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
at Microsoft.Internal.Collections.WeakReferenceCollection`1.<CleanupDeadReferences>b__0(WeakReference w)
at System.Collections.Generic.List`1.RemoveAll(Predicate`1 match)
at Microsoft.Internal.Collections.WeakReferenceCollection`1.CleanupDeadReferences()
at Microsoft.Internal.Collections.WeakReferenceCollection`1.Add(T item)
at System.ComponentModel.Composition.Hosting.ImportEngine.StartSatisfyingImports(PartManager partManager, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.EngineContext.Complete()
at System.ComponentModel.Composition.Hosting.AtomicComposition.FinalComplete()
Comments: I also sometimes experiment this issue and have no clue what the problem can be. So far I get it while trying to access GetExportedValue<T> of a service exported as NonShared. What does the cleanup of dead reference has to do there ? :| Any help is welcome.
ProcessEntry() failed. InvalidOperationException: AtomicComposition encountered an unexpected Exception, review InnerException for details.
Stack Trace:
at System.ComponentModel.Composition.Hosting.AtomicComposition.FinalComplete()
at System.ComponentModel.Composition.Hosting.AtomicComposition.Complete()
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.DetermineRejection(ComposablePartDefinition definition, AtomicComposition parentAtomicComposition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.IsRejected(ComposablePartDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InnerCatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValueCore[T](String contractName, ImportCardinality cardinality)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValue[T](String contractName)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValue[T]()
--------------------------Inner Exception--------------------------
AggregateException: One or more errors occurred.
NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
at Microsoft.Internal.Collections.WeakReferenceCollection`1.<CleanupDeadReferences>b__0(WeakReference w)
at System.Collections.Generic.List`1.RemoveAll(Predicate`1 match)
at Microsoft.Internal.Collections.WeakReferenceCollection`1.CleanupDeadReferences()
at Microsoft.Internal.Collections.WeakReferenceCollection`1.Add(T item)
at System.ComponentModel.Composition.Hosting.ImportEngine.StartSatisfyingImports(PartManager partManager, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.EngineContext.Complete()
at System.ComponentModel.Composition.Hosting.AtomicComposition.FinalComplete()
Comments: I also sometimes experiment this issue and have no clue what the problem can be. So far I get it while trying to access GetExportedValue<T> of a service exported as NonShared. What does the cleanup of dead reference has to do there ? :| Any help is welcome.