CommunityToolkit / CommunityToolkit/dotnet
No response was received for the given async request message
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Description
### 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
```cs
public class DisplayActionSheetAsyncRequestMessage : AsyncRequestMessage
{
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
```cs
string action = await Messenger.Send(new DisplayActionSheetAsyncRequestMessage(
"Test Title",
"Cancel",
null,
"action1", "action2"));
```
Receiver
```cs
// at ContentPage ctor:
WeakReferenceMessenger.Default.Register(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
- [X] 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
Contributor guide
Assessment
This issue has not been assessed yet.