Prism: DuplicateModuleException thrown

Created on 17 May 2019  路  12Comments  路  Source: PrismLibrary/Prism

Description

I'm getting a DuplicateModuleException when none of my modules share the same fully qualified name.

Steps to Reproduce

  1. Create App
  2. Add Module: Modules.Mapping.Customers (CustomerModule)
  3. Add Module Modules.Volume.Customers (CustomerModule)

Expected Behavior

It works

Actual Behavior

Exception thrown

Basic Information

Prism 7.1.0.431
Prism.Unity.Wpf 7.1.0.431
Prism.Wpf 7.1.0.431
VS2017
WPF

Screenshots

Prism.Modularity.DuplicateModuleException
HResult=0x80131500
Message=A duplicated module with name CustomerModule has been found by the loader.
Source=Prism
StackTrace:
at Prism.Modularity.ModuleCatalogBase.ValidateUniqueModules()
at Prism.Modularity.ModuleCatalogBase.Validate()
at Prism.Modularity.ModuleCatalogBase.Initialize()
at Prism.Modularity.ModuleManager.Run()
at Prism.PrismApplicationBase.InitializeModules()
at Prism.PrismApplicationBase.Initialize()
at Prism.PrismApplicationBase.InitializeInternal()
at Prism.PrismApplicationBase.OnStartup(StartupEventArgs e)
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Intel.Client.WpfApp.App.Main()

Reproduction Link

All 12 comments

Module names must be unique. Also, you didn't provide a reproduction app.

The module names are unique if you look at the fully qualified namespace.
Do you think Intel is going to let me give you my app? Umm. No.
Do I need to create a sample app for you to prove it?

The issue template explicitly states that all issues must have a reproduction app or they will be closed. This is by design. If you would like this changed, Intel can become a Patron to support the project, and I can consider the design change after proper analysis.

Thought we paid enough in Infragistics licenses. ;) I guess you don't remember the conference call where all I wanted to hear about was Prism when you guys were demoing Infragistics features.

I'll build a simple sample app. My current app has 54 projects with 29 modules.

Unfortunately for Intel, Prism isn't owned by Infragistics. If it was, then this would probably be going a different direction 馃槃

I am moving to a mobility team doing Android and iOS deployments once I finish my current project. So I'll continue using Prism but in a different way. Once I get moved, I'll see if I can get someone to pony up some support cash. Things are tight with now.

Thanks for the repo, I'll take a look to make sure my initial assumption of by design was correct or not.

For me, it barfs on start-up. That's why there projects are the absolute minimum.

Ahh, now I see what you were after. That's why I need a repro 馃槃

Since you have a conflict, just provide the name:

moduleCatalog.AddModule<Modules.Dimension.Customers.CustomersModule>(typeof(Modules.Dimension.Customers.CustomersModule).FullName);
moduleCatalog.AddModule<Modules.Volume.Customers.CustomersModule>(typeof(Modules.Volume.Customers.CustomersModule).FullName);

You could also just use strings instead of getting the FullName off the type.

Cool. That worked. Thanks!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings