V1.5.1 An unexpected exception was caught - in log but no problems in frontend though

Topics: Core, General
Jul 24, 2012 at 7:37 PM

I getting the following error in the log file when i browse through my frontend but everything is working as expected:

2012-07-24 20:33:44,365 [48] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caughtSystem.Reflection.TargetException: Object does not match target type.   at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)   at Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in D:\Mercurial\Orchard 1.5.1\src\Orchard\Events\DefaultOrchardEventBus.cs:line 83   at Orchard.Events.DefaultOrchardEventBus.TryInvoke(IEventHandler eventHandler, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in D:\Mercurial\Orchard 1.5.1\src\Orchard\Events\DefaultOrchardEventBus.cs:line 68   at Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 eventData, IEnumerable& returnValue) in D:\Mercurial\Orchard 1.5.1\src\Orchard\Events\DefaultOrchardEventBus.cs:line 52

Jul 25, 2012 at 2:16 PM

Two or more Event handlers are generating the same key for the EventBus cache - only one will be cached resulting in an error each time an event occurs that is not matched by an Event Handler.

The error does not indicate which Event Handler is not matched (duplicated) - it's a case of elimination of modules enabled and page content (content types used).

In 1.5RC this occurred when ContentPicker and Fields modules were enabled and the page contained content types with fields such as media picker - this was fixed in changeset  fda16f52639e prior to the release of 1.5.1.

The most likely culprit is the Event Handler class name (type) repeated in different modules - the namespace is not taken into account when generating the key for the EventBus cache - you may have modules duplicating an existing Orchard Event Handler - the key is type_interface_method_arguments

Coordinator
Jul 25, 2012 at 5:47 PM

We might want to take the namespace into account then. Can you open the bug ?