CommunityToolkit / CommunityToolkit/dotnet
CollectionView with RemainingItemsThresholdReachedCommand does not like RelayCommand bound methods
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
When making an async method and annotate it with the RelayCommand attribute, assigning it to the RemainingItemsThresholdReachedCommand will generate some weirdness, the method will only rarely execute correctly. But when I create an AsyncRelayCommand myself and remove the RelayCommand attribute, everything works as expected
### Regression
_No response_
### Steps to reproduce
1. Create a CollectionView with the RemainingItemsThresholdReachedCommand event and some items, so you can get to the threshold
Example:
``
2. Create the function
Example:
```cs
[RelayCommand]
private async Task MyAsyncFunction()
{
await Task.Delay(2000);
Debug.WriteLine("Hello, world!");
}
```
3. Observe that the function does not fire correctly
### Expected behavior
Whenever the collectionview reaches its end, the event gets fired normally
### Screenshots
_No response_
### IDE and version
Rider
### IDE version
JetBrains Rider 2024.3
### Nuget packages
- [x] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [ ] CommunityToolkit.Mvvm (aka MVVM Toolkit)
### Nuget package version(s)
8.4.0
### Additional context
_No response_
### Help us help you
No, just wanted to report this
Contributor guide
Assessment
This issue has not been assessed yet.