When attempting to run the ViewSwitchingNavigation.Silverlight project, I get the following error:
Activation error occured while trying to get instance of type Object, key "InboxView"
Message "Activation error occured while trying to get instance of type Object, key \"InboxView\""
StackTrace " at Microsoft.Practices.Prism.MefExtensions.MefServiceLocatorAdapter.DoGetInstance(Type serviceType, String key)\r\n at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type
serviceType, String key)"
Any suggestions on how to get this working? I can obviously see what is going on conceptually by looking at the code, but it would be good to have this sample running. I've tried searching for solutions to this problem but to no avail - is this quickstart
working for others?
Perhaps the problem you are facing is caused by the fact that you are using an old version of Prism. You can find the latest version
You should also make sure that you are fulfilling Prism´s prerequisites (you can find them in
If you are still facing problems running the QuickStarts, it would be helpful if you could provide us with more information about the exception you are experiencing.
I hope you find this information useful.
Dec 14, 2010 at 4:08 AM
Edited Dec 14, 2010 at 11:35 PM
I had previously installed prism 4 drop 10, but have now deleted that. I have uninstalled Blend and all Silverlight related installs, and reinstalled from scratch (Blend 4). For some reason the ViewSwitching navigation quickstart now works, but the MVVM
RI will not, and it is failing with many similar errors, based on the following:
The tag '<tag>' does not exist in XML namespace 'http://schemas.microsoft.com/expression/2010/interactions'
<tag> includes: PropertyChangedTrigger, GoToStateAction, DataTrigger, ChangePropertyAction, CallMethodAction etc.
I have removed the references from Microsoft.Expression.Interactions and readded to C:\Program Files\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries, but still get the same build errors. I should have mentioned that I'm using WindowsXP SP3, VS2010,
Silverlight 4, Blend 4.
Also, when I try to run the Stocktrader RI (Silverlight), I'm getting the following error:
An exception occurred while creating a region with name 'ResearchRegion'. The exception was: System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors
property for more detailed information. 1) Could not load file or assembly 'System.Windows.Controls.DataVisualization.Toolkit, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Resulting in: An exception occurred while trying to create an instance of type 'StockTraderRI.Modules.Market.TrendLine.TrendLineView'. Resulting in: Cannot activate part 'StockTraderRI.Modules.Market.TrendLine.TrendLineView'. Element: StockTraderRI.Modules.Market.TrendLine.TrendLineView
--> StockTraderRI.Modules.Market.TrendLine.TrendLineView --> AssemblyCatalog (Assembly="StockTraderRI.Modules.Market, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null") Resulting in: Cannot get export 'StockTraderRI.Modules.Market.TrendLine.TrendLineView
(ContractName="System.Object")' from part 'StockTraderRI.Modules.Market.TrendLine.TrendLineView'. Element: StockTraderRI.Modules.Market.TrendLine.TrendLineView (ContractName="System.Object") --> StockTraderRI.Modules.Market.TrendLine.TrendLineView
--> AssemblyCatalog (Assembly="StockTraderRI.Modules.Market, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null") at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart
part, ExportDefinition definition) at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart) at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
at System.ComponentModel.Composition.Primitives.Export.get_Value() at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export) at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedLazyOfTM>b__0()
at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at StockTraderRI.Infrastructure.AutoPopulateExportedViewsBehavior.AddRegisteredViews() at StockTraderRI.Infrastructure.AutoPopulateExportedViewsBehavior.OnAttach()
at Microsoft.Practices.Prism.Regions.RegionBehavior.Attach() at Microsoft.Practices.Prism.Regions.RegionBehaviorCollection.Add(String key, IRegionBehavior regionBehavior) at Microsoft.Practices.Prism.Regions.RegionAdapterBase`1.AttachDefaultBehaviors(IRegion
region, T regionTarget) at Microsoft.Practices.Prism.Regions.RegionAdapterBase`1.Initialize(T regionTarget, String regionName) at Microsoft.Practices.Prism.Regions.RegionAdapterBase`1.Microsoft.Practices.Prism.Regions.IRegionAdapter.Initialize(Object regionTarget,
String regionName) at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName).
Dec 14, 2010 at 2:31 PM
Thank you for providing additional information. You might have followed the installation steps incorrectly, or you might have missed one of the steps needed to run the solutions you're mentioning.
You can read about this in the
Prism 4.0 Readme article from the MSDN documentation.
For example, for the
MVVM Reference Implementation, you need to follow these steps (from the documentation):
- You must have completed the steps in
- In Windows Explorer, double-click the following batch file to open the solution in Visual Studio:
Silverlight Only - MVVM Reference Implementation.bat
- Set the MVVM.Web project as the startup project.
- Press F5.
As for the error that mentions "(...)Could not load file or assembly 'System.Windows.Controls.DataVisualization.Toolkit", you could try installing the
Silverlight 4 Toolkit.
I hope you find this helpful.
Guido Leandro Maliandi
Thanks for the response. i've followed all of the steps in the prism readme, and also in the quickstart documentation. I installed the Silverlight 4 toolkit and tried to rebuild/rerun both of the solutions mentioned in the previous post and still have the
I've since had some success though.
I've found that it was necessary to add System.core v 126.96.36.199 and System.Windows.Interactivity 188.8.131.52 to the GAC, which fixed some of the build errors.
For the issues with the StocktraderRI.Silverlight it was necessary to add references to System.Windows.Controls.DataVisualization.Toolkit and System.Windows.Controls.Toolkit to the StocktraderRI.Silverlight project. These are needed by some of the other
modules, but without the references in the project that initialises the modules, they weren't added into the XAP and hence couldn't be found at runtime.
Not sure why I had to manually add to the gac, and not sure why these things weren't done in the default, downloaded quickstarts, but it's good to have them working now.