Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've had the same thing happen to me when upgrading from an older version of MVVM Light (change set 3bdbffb4e70a “BL0014 Misc”). Instantly Send() stopped working.</p> <p><strong>To resolve the issue try using using the .Register() overload with receiveDerivedMessagesToo set to true.</strong></p> <p>This issue can happen when Send()ing objects which have some type of DynamicProxy created for them. For example EntityFramework will do this when you use the Local property under any of the collections of your data context.</p> <p>e.g. EntityFramework DBContext for ctx.Dealers.Local will generate a list of items of type that look like: <strong>System.Data.Entity.DynamicProxies.Dealer_D4CEAA0F527F5360DEB9B2B35305241B76A107C37B9DB8B368984B7DF69AEE1E</strong></p> <p>When matching to Registered Listeners Messenger.SendToTargetOrType() will fail since the Registered Type is just a "Dealer" and not a Proxy of the dealer.</p> <p>Why did this used to work without requiring receiveDerivedMessagesToo set to true and it doesn't now?</p> <p>Previously MVVM Light "Messenger.cs" Messenger.SendToTargetOrType() had this code:</p> <pre><code>private void SendToTargetOrType&lt;TMessage&gt;(TMessage message, Type messageTargetType, object token) { var messageType = typeof(TMessage); </code></pre> <p>This worked great since the actual type of the data being passed did not matter, just the type of the registed type.</p> <p>Now the code has been changed to:</p> <pre><code>private void SendToTargetOrType&lt;TMessage&gt;(TMessage message, Type messageTargetType, object token) { Type messageType = message.GetType(); </code></pre> <p>Now the Type of the parameter is being used instead. This is a problem since if your "message" is of some type of proxy the search of Registed listeners will fail.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload