TriggerAction failed to access method exception (in Silverlight client)

TriggerAction failed to access method exception (in Silverlight client)

Old forum URL: forums.lhotka.net/forums/t/10575.aspx


TSF posted on Monday, August 01, 2011

CSLA 4.1 / Silverlight exception:  "Attempt by method 'Csla.Xaml.TriggerAction.CallMethod(System.Object, System.EventArgs)' to access method 'MyNamespace.SL.CustomerCallPlanVM.SetDay(System.Object, Csla.Xaml.ExecuteEventArgs)' failed."

This same exact xaml works fine in my WPF client:

<csla:TriggerAction TargetControl="{Binding ElementName=chkMonday}"
           TriggerEvent="Checked"
           DataContext="{Binding Source={StaticResource customerCallPlanViewSource}}"
           MethodName="SetDay"
           MethodParameter="Monday"/> 

Here is the code-behind in the VM :

public void SetDay(object sender, ExecuteEventArgs e) { ... }

Note that a breakpoint in the first line of SetDay never gets hit.  Also - just for testing I've taken out all code inside the SetDay method and just put in a simply message box and still get the exception.  In addition, I tried removing the parameters from the method and the corresponding one from the xaml, and still get the same thing.

TSF replied on Monday, August 01, 2011

In case this helps, here is the stack trace:

" at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags)\r\n at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, UInt32 invocationFlags)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)\r\n at Csla.Xaml.TriggerAction.CallMethod(Object sender, EventArgs e)\r\n at System.Windows.Controls.Primitives.ToggleButton.OnChecked(RoutedEventArgs e)\r\n at System.Windows.Controls.Primitives.ToggleButton.OnIsCheckedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)\r\n at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)\r\n at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)\r\n at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)\r\n at System.Windows.Controls.Primitives.ToggleButton.OnToggle()\r\n at System.Windows.Controls.Primitives.ToggleButton.OnClick()\r\n at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)\r\n at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)\r\n at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)"

Copyright (c) Marimer LLC