CommunityToolkit / dotnet

.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.

Home Page:https://docs.microsoft.com/dotnet/communitytoolkit/?WT.mc_id=dotnet-0000-bramin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

jingliancui opened this issue · comments

commented

Describe the bug

Message will be occurred twice.
Lead exception thrown.

Regression

No response

Steps to reproduce

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