ActivationException at at Microsoft.Practices.Prism.MefExtensions.MefServiceLocatorAdapter.DoGetInstance(Type serviceType, String key)

Topics: Prism v4 - Silverlight 4
Jul 13, 2011 at 12:29 PM
Edited Jul 13, 2011 at 12:30 PM

Hi Please help.

Below is the code.



        public SchemaDetailsViewModel(ISchemaModel mode,IEventAggregator eventAggregator)





    public class SchemaClassDataModel : BaseModel<SchemaEntityContext>, ISchemaModel



        public void GetSchemasAsync()





        private void InternalExecute()



            Execute(Context.GetSchemasQuery(), OnGetSchemasComplete);






 public interface ISchemaModel


        void GetSchemasAsync();

        event EventHandler<EntityResultsArgs<SchemaClassDto>> OnGetSchemasComplete;


It raises exception in saying cannot create region. refer key/value for more details....


It works fine if I get rid of the 1st parameter in the ScemaClassViewModel Constructor. I've all imports/exports in place. Just don't understand what I'm missing.

Please help. I'm have been struggling to death with this


I get below error:

{Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type SchemaClassList, key ""   at Microsoft.Practices.Prism.MefExtensions.MefServiceLocatorAdapter.DoGetInstance(Type serviceType, String key)   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)}

the inner exception also has

'(((System.Linq.Expressions.LambdaExpression)((((System.ComponentModel.Composition.Primitives.ImportDefinition[])(((new System.Collections.Generic.Mscorlib_CollectionDebugView<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>((new System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy(((Microsoft.Practices.Prism.MefExtensions.MefBootstrapper)(bootStrapper)).AggregateCatalog)).Parts)).Items[2]).ImportDefinitions))[1]).Constraint)).Type).GenericParameterPosition' threw an exception of type 'System.InvalidOperationException'



Jul 13, 2011 at 1:19 PM

I figured this out.


Basically the Interface was saved in a different dll. It had to added to aggregateCatalog.

So did that in the bootstrapper class

Jul 14, 2011 at 7:34 PM

Hi Kavya,

I'm glad that you've found a solution to your situation. Thank you for sharing it with the rest of the community, as it might be helpful for other users facing similar problems.

Guido Leandro Maliandi