문제가 있습니다. 디버거가 CivicaHousingRepairsModule을 전혀 사용하지 않음을 알리는 것이 중요합니다. 첫 번째 줄에 중단 점을 삽입하십시오 ... 아무런 히트가 없습니다.) 마지막 2 일 이후 아무 단서도없이. Silverlight 4, PRISM 4.0 및 MEF를 사용하여 샘플 응용 프로그램을 만들었습니다. 어떤 contian 두 모듈은 다음과 같습니다. 이제 다음 중단 점을 삽입해도 아무 것도 치지 않고 오류가 발생하면 디버거에서 모듈을 전혀 누르지 않습니다.
//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
}
}
는 모듈 (
ModuleCatalog.xaml를) regestring 코드입니다. 이제 다음
<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>
는 부트 스트 래퍼
코드입니다 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;
}
.
.
.
}
문제 : 내가 다른 (수리)에 하나 개의 모듈 (보안)에서 이동
는 다음 날 줄 것이다 다음 오류
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로 설정했습니다.
같은 문제에 직면했을 때 그 해결책을 찾았 으면 알려주세요. 귀하의 답변이나 제안에 감사드립니다.
위의 질문을 읽는 열정이있는 사람은 누구입니까?) uhhhhhhhh 읽어 주셔서 감사합니다. –
제발 대답 ..... –
당신은'디버그 | 옵션 및 설정 | 일반 | 내 코드 만 사용 (관리 전용) '옵션을 선택하십시오. 때로는 디버거가 파일의 출처에 대해 다소 혼란 스러울 수 있습니다. 이 옵션을 해제하면 일반적으로 아무 곳이나 중단 점을 설정할 수 있습니다. –