No response was received for the given async request message
CodingOctocat opened this issue · comments
Describe the bug
I am using AsyncRequestMessage in MAUI, I have added a button in the group header of the CollectionView, clicking on the button sends an AsyncRequestMessage but sometimes it raises an exception System.InvalidOperationException: 'No response was received for the given request message.' What I mean is that I may click on the button 1, 2, 5 ... times and it will be fine, but maybe it will raise this exception.
Regression
No response
Steps to reproduce
AsyncRequestMessage
public class DisplayActionSheetAsyncRequestMessage : AsyncRequestMessage<string>
{
public string[] Buttons { get; }
public string? Cancel { get; }
public string? Destruction { get; }
public string? Title { get; }
public DisplayActionSheetAsyncRequestMessage(string? title, string? cancel, string? destruction, params string[] buttons)
{
Title = title;
Cancel = cancel;
Destruction = destruction;
Buttons = buttons;
}
}
Sender
string action = await Messenger.Send(new DisplayActionSheetAsyncRequestMessage(
"Test Title",
"Cancel",
null,
"action1", "action2"));
Receiver
// at ContentPage ctor:
WeakReferenceMessenger.Default.Register<MyContentPage, DisplayActionSheetAsyncRequestMessage>(this,
(r, m)
=> m.Reply(r.DisplayActionSheet(m.Title, m.Cancel, m.Destruction, m.Buttons))
);
Expected behavior
It's always normal. It's not raise System.InvalidOperationException: No response was received for the given async request message
Screenshots
No response
IDE and version
VS 2022
IDE version
17.10.3
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.2.2
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item