Why's MVVMLight's message sent in vain?
See original GitHub issueDear @brminnick, after reading #35, I’d like to ask if you’d elaborate on this a bit further?
Because after watching your YT video, I implemented my commands (unifying your awesome IAsyncCommand
with customer given requirement of using MVVMLight’s RelayCommand
) like this:
public IAsyncCommand<string> SaveCommand => _save ?? (_save = new AsyncRelayCommand<string>(async title =>
{
await Task.WhenAll(DataService.UpdateTitle(title), CloseDialog(EDITOR_TITLE)).ConfigureAwait(false);
Messenger.Default.Send(new TitleFinishedMessage(title));
},
title => !string.IsNullOrWhiteSpace(title),
async exception => await ShowError("Title update failed.", exception).ConfigureAwait(false)));
And that’s because, using it like
await Task.WhenAll(DataService.UpdateTitle(title), CloseDialog(EDITOR_TITLE, new TitleFinishedMessage(title)))
.ConfigureAwait(false);
with a centralized Messenger.Default.Send(message)
inside CloseDialog()
still sends the message, but in vain then.
I’ve already verified it’s not because of using continueOnCapturedContext
’s value for MVVMLight’s constructors keepTargetAlive
parameter, too: passing true
instead (ignoring potential memory leak for this) still doesn’t fix the “message in vain” problem.
Can you help me, understanding this mystery?
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
MVVM Light Messenger executing multiple times
The MVVMLight Messenger class will register the same item 'x' number of times. This is why when you call the Send you get...
Read more >Untitled
Heinrich heine die loreley text, Manuelcha prado y princesita de yungay, ... Disgaea hour of darkness psp download, Send text message metro pcs...
Read more >Untitled
... proservis temporales s.a pasto. send unlimited friend request on facebook ... iliada de homero completa online. resinas concordia s.a.email. why there ...
Read more >Migrating from MvvmLight - .NET Community Toolkit
This article outlines some of the key differences between the MvvmLight Toolkit and the MVVM Toolkit to ease your migration.
Read more >Untitled
... map news score team text today top. officers certificate vs secretary's ... cqc argentina 2014 programa completo globo. galasoft mvvmlight extras wpf4....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll try to boil it down to kinda POC, but due to sprint commitments, that might take until Friday.
To minimize your need to dig deep while still obeying given business secrets constraints, I hope “view + viewmodel + faked data service (i. e. fixed values instead of an actual WebAPI service)” will still reproduce the bug - or at least outline how it’s working in real code…
Keep your fingers crossed on this one! 😉
I appreciate the kind words!
Are you able to provide a reproduction sample? I’d be happy to dig into the code.