Quantcast
Channel: MVVM Light Toolkit
Viewing all articles
Browse latest Browse all 1826

Commented Issue: Messenger: Non-static method requires a target [7579]

$
0
0
Hi,
I'm facing the following error: "Non-static method requires a target" in function:

/// <summary>
/// Executes the action. This only happens if the action's owner
/// is still alive.
/// </summary>
/// <param name="parameter">A parameter to be passed to the action.</param>
public void Execute(T parameter)
{
if (_staticAction != null)
{
_staticAction(parameter);
return;
}

if (IsAlive)
{
if (Method != null
&& ActionReference != null)
{
Method.Invoke(
ActionTarget,
new object[]
{
parameter
});
}

#if SILVERLIGHT
if (_action != null)
{
_action(parameter);
return;
}
#endif
}
}

I think that ActionTarget should be checked against null before calling Invoke.
Comments: Hi, I don't know if this is related, but I get the same error when I register for same message type in two different ModelViews.

Viewing all articles
Browse latest Browse all 1826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>