CompositeWPF/Prism EventAggregation Exception

|  Posted: March 4, 2010  |  Categories: General Technical

Just a small reminded for myself. When you are using Publish/Subscribe EventAggregation mechanism provided by PRISM along with Unity to resolve types. It’s important to specify the Action method on subscribe to be public.

Example:

TextChangedEvent evt = eventAggregator.GetEvent<TextChangedEvent>();
evt.Subscribe(OnSubscibeForNewText);

///

///

public void OnSubscibeForNewText(string payload)

If it’s not public, Unity will have issues resolving the type and you’ll see an exception as shown below

Attempt by method ‘Microsoft.Practices.Composite.Events.DelegateReference.TryGetDelegate()’ to access method ‘ModuleA.ViewModel.ModuleAView2VM.OnSubscibeForNewText(System.String)’ failed.

Author: Saravana Kumar

Saravana Kumar is the Founder and CTO of BizTalk360, an enterprise software that acts as an all-in-one solution for better administration, operation, support and monitoring of Microsoft BizTalk Server environments.

One Platform Operations, Monitoring and Analytics Software
BizTalk360

microsoft biztalk

Learn more

Over 500 customers across 30+ countries depend on BizTalk360

ServiceBus360

Azure Composite Application

Learn more

Start manage and monitor your Azure Services in minutes

One Platform - Operations, Monitoring and Analytics Software
BizTalk360

microsoft biztalk

Learn more

Over 500 customers across 30+ countries depend on BizTalk360

One Platform - Operations, Monitoring and Analytics Software
ServiceBus360

Azure Composite Application

Learn more

Start manage and monitor your Azure Services in minutes

Back to Top