Limit on Number of Modules?

Topics: Prism v2 - Silverlight 3
Nov 4, 2009 at 3:10 PM

I've built a fairly complex Silverlight application using Prism.  I've run in to a slight issue where all modules do not seem to initialize properly when using either:

  1. A large number of modules (more than 25)
  2. A large number of module dependencies.  For example, if I have 20 modules, but 10 of them are dependent on an 'Initialization' module.

As an example, suppose I have a module called 'DBLogger'.  By using breakpoints, I was able to verify that the constructor for DBLogger runs properly, with the proper injection of IEventAggregator.  The EventAggregator looks correct, with the right number of subscriptions etc.  I can step through the code and see that it DBLogger subscribes to a 'Log' event.  If I breakpoint another module that publishes a 'Log' event, I can see that the event is actually published, but the DBLogger never executes the associated code.  Interestingly enough, if I have another module named 'TextLogger' that subscribes to a Log event, the TextLogger will execute the associated code.

It doesn't really seem to matter if I use service dependencies, or what order I load the modules.  The same modules appear to fail when I have more than 25 or so modules.  I'm kind of at a loss.  Are there any known limitations in regards to the number of modules in use, or is that a coincidence and it is more likely that I have some 'broken' code somewhere?

Nov 9, 2009 at 5:21 PM


There are no limitations related to the amount of modules your application can have. Possible reasons for this behavior with the EventAggregator, could be related to different reasons:

  1. The EventAggregator instances in each module are different. You can read about that in this thread.
  2. The Events are not being strong referenced, and are being garbage collected. You can read about this in this post from Ward Bell.

Please let me know if this helps.

Damian Schenkelman