Using Prism Scultpure I am facing this problem
Can some one help me what to do. I have R1 Region but it raise the follwoing error
The bold line in the following code is the error
public virtual void StartAction()
{
global::System.ComponentModel.BackgroundWorker backgroundWorker = new global::System.ComponentModel.BackgroundWorker();
backgroundWorker.WorkerReportsProgress = true;
backgroundWorker.DoWork += new global::System.ComponentModel.DoWorkEventHandler(this.StartActionWorker);
backgroundWorker.RunWorkerAsync();
CandidateView candidateView = null;
foreach (object view in **this.RegionManager.Regions["R1"].Views**)
{
if (true == view is CandidateView)
{
candidateView = view as CandidateView;
break;
}
}
if (null == candidateView)
{
candidateView = this.Container.GetExportedValue<CandidateView>();
this.RegionManager.Regions["R1"].Add(candidateView);
}
this.RegionManager.Regions["R1"].Activate(candidateView);
}
The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information. 1) The region manager does not contain the R1 region. Resulting in: An exception occurred while initializing module 'CandidateMModule'. - The exception message was: The region manager does not contain the R1 region. - The Assembly that the module was trying to be loaded from was:Candidate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Check the InnerException property of the exception for more information. If the exception occurred while creating an object in a DI container, you can exception.GetRootException() to help locate the root cause of the problem. Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'. Resulting in: Cannot activate part 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'. Element: Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> AssemblyCatalog (Assembly="Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") Resulting in: Cannot get export 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager (ContractName="Microsoft.Practices.Prism.Modularity.IModuleManager")' from part 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'. Element: Microsoft.Practices.Prism.MefExtensions.Modul开发者_C百科arity.MefModuleManager (ContractName="Microsoft.Practices.Prism.Modularity.IModuleManager") --> Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> AssemblyCatalog (Assembly="Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
You are probably trying to populate the region before it's loaded. Check if the region is registered with RegionManager.Regions.ContainsRegionWithName("R1")
精彩评论