question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why's MVVMLight's message sent in vain?

See original GitHub issue

Dear @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:closed
  • Created 3 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Eagle3386commented, Sep 30, 2020

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! 😉

1reaction
brminnickcommented, Sep 30, 2020

I appreciate the kind words!

Are you able to provide a reproduction sample? I’d be happy to dig into the code.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found