如果我插入断点,调试器根本不会命中模块,不会命中任何内容并给出错误

发布于 2025-01-08 20:56:48 字数 13425 浏览 0 评论 0原文

我遇到了问题(重要的是要注意调试器没有命中 CivicaHousingRepairsModule 根本...如果我在第一行插入断点...什么都不会被击中。)自过去 2 天以来没有任何线索。 我使用 Silverlight 4、PRISM 4.0 和 MEF 创建了示例应用程序。其中包含两个模块,如下所示。

//Module 1
namespace Civica.Housing.Security
{
    [ModuleExport(typeof(CivicaHousingSecurityModule),InitializationMode = InitializationMode.OnDemand)]
    public class CivicaHousingSecurityModule:IModule
    {
         private readonly IRegionManager _regionManager;
         [ImportingConstructor] //MEF magic to for resolving all the DI
         public CivicaHousingSecurityModule(IRegionManager regionManager, IAuthenticationService authenticationService)
         {
             regionManager.CheckForNull("regionManager");
             _regionManager = regionManager;
         }
         #region IModule Implementation
         public void Initialize()
         {
         } 
         #endregion
    }
}

//Module 2
namespace Civica.Housing.Repairs
{
    [ModuleExport(typeof(CivicaHousingRepairsModule), InitializationMode = InitializationMode.OnDemand)]
    public class CivicaHousingRepairsModule : IModule
    {
        private readonly IRegionManager _regionManager;
        #region Constructor
        [ImportingConstructor] 
        public CivicaHousingRepairsModule(IRegionManager regionManager, IAuthenticationService authenticationService)
        {
            regionManager.CheckForNull("regionManager");
            _regionManager = regionManager;
        }
        #endregion
        #region IModule Implementation
        public void Initialize()
        {
            _regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(TestView));
        }
        #endregion
    }
}

现在以下是 regestring 模块 (ModuleCatalog.xaml) 的代码。

<Modularity:ModuleCatalog xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                          xmlns:sys="clr-namespace:System;assembly=mscorlib" 
                          xmlns:Modularity="clr-
namespace:Microsoft.Practices.Prism.Modularity;assembly=Microsoft.Practices.Prism">
    <Modularity:ModuleInfo Ref="Civica.Housing.Security.xap" InitializationMode="OnDemand" 
ModuleName="CivicaHousingSecurityModule" />
    <Modularity:ModuleInfo Ref="Civica.Housing.Repairs.xap" InitializationMode="OnDemand" 
ModuleName="CivicaHousingRepairsModule" />
</Modularity:ModuleCatalog>

现在以下是Bootstrapper的代码

 public class CivicaHousingBootstrapper : MefBootstrapper
    {
        private const string ModuleCatalogUri = 

"/Civica.Housing.App;component/ModulesCatalog.xaml";
.
.
.
 protected override Microsoft.Practices.Prism.Modularity.IModuleCatalog CreateModuleCatalog()
        {
            var moduleCatalog=Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml

(new Uri(ModuleCatalogUri,


UriKind.Relative));
            return moduleCatalog;            
        }
.
.
.
}

问题:

当我从一个模块(安全)导航到另一个模块(修复)时,它会给我以下错误 strong>

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 
2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; 
Tablet PC 2.0)
Timestamp: Wed, 22 Feb 2012 13:18:00 UTC
Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError   
Message: Microsoft.Practices.Prism.Modularity.ModuleInitializeException: An exception 
occurred while initializing module 'CivicaHousingRepairsModule'. 
    - The exception message was: The composition remains unchanged. The changes were rejected 
because of the following error(s): The composition produced multiple composition errors, with 3 
root causes. The root causes are provided below. Review the CompositionException.Errors property 
for more detailed information.
1) More than one export was found that matches the constraint '((exportDefinition.ContractName == 
"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey
("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.DashboardViewModel'.
Element: Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.DashboardViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

2) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.ShortcutViewModel'.
Element: Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.ShortcutViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

3) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.HeaderViewModel'.
Element: Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.HeaderViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, 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.  ---> System.ComponentModel.Composition.ChangeRejectedException: 

The composition remains unchanged. The changes were rejected because of the following error(s): 

The composition produced multiple composition errors, with 3 root causes. The root causes are 

provided below. Review the CompositionException.Errors property for more detailed information.

1) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.DashboardViewModel'.
Element: Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.DashboardViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

2) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.ShortcutViewModel'.
Element: Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.ShortcutViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

3) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.HeaderViewModel'.
Element: Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.HeaderViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

   at System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition 

atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.OnExportsChanging

(ExportsChangeEventArgs e)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.OnCatalogChanging(Object 

sender, ComposablePartCatalogChangeEventArgs e)
   at System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.OnChanging(Object 

sender, ComposablePartCatalogChangeEventArgs e)
   at System.ComponentModel.Composition.Hosting.AggregateCatalog.OnChanging

(ComposablePartCatalogChangeEventArgs e)
   at 

System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.RaiseChangingEvent

(Lazy`1 addedDefinitions, Lazy`1 removedDefinitions, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.Add

(ComposablePartCatalog item)
   at Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleInitializer.CreateModule

(ModuleInfo moduleInfo)
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError

(ModuleInfo moduleInfo, String assemblyName, Exception exception)
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
   at Microsoft.Practices.Prism.Modularity.ModuleManager.InitializeModule(ModuleInfo moduleInfo)
   at Microsoft.Practices.Prism.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad()
   at Microsoft.Practices.Prism.Modularity.ModuleManager.IModuleTypeLoader_LoadModuleCompleted

(Object sender, LoadModuleCompletedEventArgs e)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.RaiseLoadModuleComplete

d(LoadModuleCompletedEventArgs e)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.RaiseLoadModuleComplete

d(ModuleInfo moduleInfo, Exception error)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.HandleDownloadCompleted

(DeploymentCatalog deploymentCatalog, AsyncCompletedEventArgs e)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.DeploymentCatalog_Downl

oadCompleted(Object sender, AsyncCompletedEventArgs e)
   at System.ComponentModel.Composition.Hosting.DeploymentCatalog.OnDownloadCompleted

(AsyncCompletedEventArgs e)
   at System.ComponentModel.Composition.Hosting.DeploymentCatalog.HandleOpenReadCompleted(Object 

sender, OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OpenReadOperationCompleted(Object arg)     

Line: 56
Char: 13
Code: 0
URI: http://localhost:61228/Civica.Housing.aspx

重要提示: 调试器根本不会命中 CivicaHousingRepairsModule 如果我

在第一行插入断点,则不会命中任何内容。

我尝试了以下操作: 1. 我已将所有 PRISM dll 的 localcopy 设置为 false。

如果您遇到同样的问题并且有好的解决方案,请告诉我。您的回答或建议将不胜感激。

I am facing problem ( Important to notice that the debugger doesn't hit
CivicaHousingRepairsModule at all .... If I insert a breakpoint in the first line ... nothing is hit.) since last 2 days without any clue.

I have created sample application using Silverlight 4,PRISM 4.0 and MEF. Which contian two modules as per following.

//Module 1
namespace Civica.Housing.Security
{
    [ModuleExport(typeof(CivicaHousingSecurityModule),InitializationMode = InitializationMode.OnDemand)]
    public class CivicaHousingSecurityModule:IModule
    {
         private readonly IRegionManager _regionManager;
         [ImportingConstructor] //MEF magic to for resolving all the DI
         public CivicaHousingSecurityModule(IRegionManager regionManager, IAuthenticationService authenticationService)
         {
             regionManager.CheckForNull("regionManager");
             _regionManager = regionManager;
         }
         #region IModule Implementation
         public void Initialize()
         {
         } 
         #endregion
    }
}

//Module 2
namespace Civica.Housing.Repairs
{
    [ModuleExport(typeof(CivicaHousingRepairsModule), InitializationMode = InitializationMode.OnDemand)]
    public class CivicaHousingRepairsModule : IModule
    {
        private readonly IRegionManager _regionManager;
        #region Constructor
        [ImportingConstructor] 
        public CivicaHousingRepairsModule(IRegionManager regionManager, IAuthenticationService authenticationService)
        {
            regionManager.CheckForNull("regionManager");
            _regionManager = regionManager;
        }
        #endregion
        #region IModule Implementation
        public void Initialize()
        {
            _regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(TestView));
        }
        #endregion
    }
}

Now following is the code for regestring Module (ModuleCatalog.xaml).

<Modularity:ModuleCatalog xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                          xmlns:sys="clr-namespace:System;assembly=mscorlib" 
                          xmlns:Modularity="clr-
namespace:Microsoft.Practices.Prism.Modularity;assembly=Microsoft.Practices.Prism">
    <Modularity:ModuleInfo Ref="Civica.Housing.Security.xap" InitializationMode="OnDemand" 
ModuleName="CivicaHousingSecurityModule" />
    <Modularity:ModuleInfo Ref="Civica.Housing.Repairs.xap" InitializationMode="OnDemand" 
ModuleName="CivicaHousingRepairsModule" />
</Modularity:ModuleCatalog>

Now following is the code for Bootstrapper

 public class CivicaHousingBootstrapper : MefBootstrapper
    {
        private const string ModuleCatalogUri = 

"/Civica.Housing.App;component/ModulesCatalog.xaml";
.
.
.
 protected override Microsoft.Practices.Prism.Modularity.IModuleCatalog CreateModuleCatalog()
        {
            var moduleCatalog=Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml

(new Uri(ModuleCatalogUri,


UriKind.Relative));
            return moduleCatalog;            
        }
.
.
.
}

PROBLEM:

When I navigate from one module (Security) to another (Repairs) then it will give me the following Error

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 
2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; 
Tablet PC 2.0)
Timestamp: Wed, 22 Feb 2012 13:18:00 UTC
Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError   
Message: Microsoft.Practices.Prism.Modularity.ModuleInitializeException: An exception 
occurred while initializing module 'CivicaHousingRepairsModule'. 
    - The exception message was: The composition remains unchanged. The changes were rejected 
because of the following error(s): The composition produced multiple composition errors, with 3 
root causes. The root causes are provided below. Review the CompositionException.Errors property 
for more detailed information.
1) More than one export was found that matches the constraint '((exportDefinition.ContractName == 
"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey
("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.DashboardViewModel'.
Element: Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.DashboardViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

2) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.ShortcutViewModel'.
Element: Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.ShortcutViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

3) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.HeaderViewModel'.
Element: Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.HeaderViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, 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.  ---> System.ComponentModel.Composition.ChangeRejectedException: 

The composition remains unchanged. The changes were rejected because of the following error(s): 

The composition produced multiple composition errors, with 3 root causes. The root causes are 

provided below. Review the CompositionException.Errors property for more detailed information.

1) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.DashboardViewModel'.
Element: Civica.Housing.Security.ViewModels.DashboardViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.DashboardViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

2) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.ShortcutViewModel'.
Element: Civica.Housing.Security.ViewModels.ShortcutViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.ShortcutViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

3) More than one export was found that matches the constraint '((exportDefinition.ContractName == 

"Civica.Housing.Services.IRepairsDataService") AndAlso (exportDefinition.Metadata.ContainsKey

("ExportTypeIdentity") AndAlso "Civica.Housing.Services.IRepairsDataService".Equals

(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))'.

Resulting in: Cannot set import 'Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService")' 

on part 'Civica.Housing.Security.ViewModels.HeaderViewModel'.
Element: Civica.Housing.Security.ViewModels.HeaderViewModel..ctor 

(Parameter="_iRepairsDataService", ContractName="Civica.Housing.Services.IRepairsDataService") 

-->  Civica.Housing.Security.ViewModels.HeaderViewModel -->  AssemblyCatalog 

(Assembly="Civica.Housing.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

   at System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition 

atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.OnExportsChanging

(ExportsChangeEventArgs e)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.OnCatalogChanging(Object 

sender, ComposablePartCatalogChangeEventArgs e)
   at System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.OnChanging(Object 

sender, ComposablePartCatalogChangeEventArgs e)
   at System.ComponentModel.Composition.Hosting.AggregateCatalog.OnChanging

(ComposablePartCatalogChangeEventArgs e)
   at 

System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.RaiseChangingEvent

(Lazy`1 addedDefinitions, Lazy`1 removedDefinitions, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.Add

(ComposablePartCatalog item)
   at Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleInitializer.CreateModule

(ModuleInfo moduleInfo)
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError

(ModuleInfo moduleInfo, String assemblyName, Exception exception)
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
   at Microsoft.Practices.Prism.Modularity.ModuleManager.InitializeModule(ModuleInfo moduleInfo)
   at Microsoft.Practices.Prism.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad()
   at Microsoft.Practices.Prism.Modularity.ModuleManager.IModuleTypeLoader_LoadModuleCompleted

(Object sender, LoadModuleCompletedEventArgs e)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.RaiseLoadModuleComplete

d(LoadModuleCompletedEventArgs e)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.RaiseLoadModuleComplete

d(ModuleInfo moduleInfo, Exception error)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.HandleDownloadCompleted

(DeploymentCatalog deploymentCatalog, AsyncCompletedEventArgs e)
   at 

Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader.DeploymentCatalog_Downl

oadCompleted(Object sender, AsyncCompletedEventArgs e)
   at System.ComponentModel.Composition.Hosting.DeploymentCatalog.OnDownloadCompleted

(AsyncCompletedEventArgs e)
   at System.ComponentModel.Composition.Hosting.DeploymentCatalog.HandleOpenReadCompleted(Object 

sender, OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OpenReadOperationCompleted(Object arg)     

Line: 56
Char: 13
Code: 0
URI: http://localhost:61228/Civica.Housing.aspx

Important Note: The debugger doesn't hit CivicaHousingRepairsModule at all If I insert a

breakpoint in the first line nothing is hit.

I tried following:
1. I have set all the PRISM dll's to localcopy to false.

Please do let me know if you have faced the same problem and you have a good solution for it. Your answers or suggestions would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红墙和绿瓦 2025-01-15 20:56:48

我认为它是因为您的 xap 文件不存在或格式损坏。请从 Web 项目中删除您的所有 xap 文件,然后逐个模块重建您的应用程序,然后尝试运行您的应用程序

I think its becoz ur xap file doesnot exist or is in corrupt format. please delete all ur xap files from web project and then rebuild ur application module by module and then try to run your application

稚然 2025-01-15 20:56:48

在您的模块项目中,您必须为所有 Prism 引用配置 CopyLocal = 'false',否则,在 MainProject 中,应为 CopyLocal= 'true'。
这对我有用。

In your modules project, you must config CopyLocal = 'false' for all Prism references, otherwise, in MainProject, it should be CopyLocal= 'true'.
It worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文