Module seems to be disposed

Topics: Prism v2 - Silverlight 3
Feb 2, 2010 at 9:36 PM


I have a module that:

  1. does some container registrations
  2. instantiates a view and adds it to a region
  3. subscribes to an event using an event aggregator (the event handler is a non-static method of the module)

Everything worked fine.

In some moment in time I removed the second part and now the event subscription does not work. My handler is not invoked when the even is published. It seems to me that the module is collected by the garbage collector or something similar.

Any ideas?

Feb 2, 2010 at 10:47 PM


A possible reason for events not firing could be because the event is being implemented with Weak References (this post provides a detailed scenario about it).

This article from the Prism documentation provides an explanation of the overload to be used to keep the subscriber alive.

Please let me know if this helps.

Damian Schenkelman

Feb 2, 2010 at 11:29 PM

thanks, that was it! Setting the argument keepSubscriberReferenceAlive to true solved the problem.