CommunityToolkit / CommunityToolkit/dotnet

MessagingCenter in multiple windows scenario throw System.InvalidOperationException: 'A response has already been issued for the current message.'

Open
#815 0 comments 1 reaction 0 assignees View on GitHub
bug :bug:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

Message will be occurred twice.
Lead exception thrown.

### Regression

_No response_

### Steps to reproduce

```text
https://github.com/jingliancui/MAUIMessagingIssue
Open sln file using vs 2022.
f5 to run the app.
click "OpenNewWin" button on the main window
click "OpenNewWin" button on the main window
click "Do Delete" button on one of the second window
click "yes" on one of the second window
click "yes" on another of the second window
exception thorwn:
System.InvalidOperationException: 'A response has already been issued for the current message.'
```

### Expected behavior

Message occurred should be under controlled.

### Screenshots

_No response_

### IDE and version

VS 2022

### IDE version

_No response_

### Nuget packages

- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [X] CommunityToolkit.Mvvm (aka MVVM Toolkit)

### Nuget package version(s)

8

### Additional context

Workaround:

1.add a id something like guid stuff in viewmodel
2.determine the id from where, than go to control the receiver's action.

### Help us help you

Yes, but only if others can assist

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.