dotnet icon indicating copy to clipboard operation
dotnet copied to clipboard

CollectionView with RemainingItemsThresholdReachedCommand does not like RelayCommand bound methods

Open JustRed23 opened this issue 1 year ago • 0 comments

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: <CollectionView RemainingItemsThreshold="1" RemainingItemsThresholdReachedCommand="{Binding MyAsyncFunctionCommand}">

  2. Create the function Example:

[RelayCommand]
private async Task MyAsyncFunction()
{
    await Task.Delay(2000);
    Debug.WriteLine("Hello, world!");
}
  1. 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

JustRed23 avatar Jan 03 '25 01:01 JustRed23