CommunityToolkit / CommunityToolkit/dotnet
Messenger keeps stacking messages even it is unregistered
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
I have come through this bug and did not find a solution for it, even AI was unable to answer me. So, I think it is a bug in the library.
I have created a sample repo as well as a video showing the behaviour.
The issue in short, is that when you register StrongReferenceMessenger and then unregister it, when you open it again previous messengers registrations will be invoked and stacking messages are in place.
Here is the repo to reproduce
https://github.com/JawadJaber/WpfTestStrongReferenceMessengerStackingIssue
### Regression
_No response_
### Steps to reproduce
https://github.com/user-attachments/assets/d0d69615-8445-46c2-a935-b4985683655a
### Expected behavior
When creating new window twice, the logger should receive only one line message not two.
### 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.4.0
### 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.