-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DispatcherQueueTimerExtensions bug #4293
Comments
Hello matheus-inacio, thank you for opening an issue with us! I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌 |
Nice catch @matheus-inacio, not sure how we haven't caught this. Mind adding your nice set of tests to our test suite as well for the future in your #4294 PR? Thanks! |
Done |
#4294) ## Fixes #4293 ## PR Type What kind of change does this PR introduce? Bugfix ## What is the current behavior? The debounce extension was incorrectly updating the action in the ConcurrentList. According to documentation the value passed in the `updateValueFactory` function, of the `AddOrUpdate` method, is the current value in the dictionary. https://docs.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentdictionary-2.addorupdate?view=net-5.0 ![image](https://user-images.githubusercontent.com/29243277/135733394-f7c4d682-9c24-45cd-af4d-69721a7c6383.png) Therefore the current behavior is maintaining the old action and not updating with the new passed action. ```csharp _debounceInstances.AddOrUpdate(timer, action, (k, v) => v); ``` ## What is the new behavior? Changed so that the action in the `_ debounceInstances` Dictionary is updated with the latest version. ## PR Checklist Please check if your PR fulfills the following requirements: <!-- and remove the ones that are not applicable to the current PR --> - [x] Tested code with current [supported SDKs](../#supported) - [x] Contains **NO** breaking changes - [x] Tests for the changes have been added - [x] Header has been added to all new source files (run build/UpdateHeaders.bat) ## Other information PS: The debuonce extension is referenced in the `CanvasPathGeometryPage` class (although this changes does not seem to break it).
Describe the bug
The Debounce extension method is not correctly updating the Action in the ConcurrentDictionary. This is causing the debounce extension to trigger the oldest version of the action in the 'chain' instead of the latest.
Steps to Reproduce
I've made a small test in order to confirm the bug:
Expected behavior
As i understand, the debounce should trigger the latest Action passed to the method.
Screenshots
Test failing:
Environment
NuGet Package(s): v7.1.0
Package Version(s): v7.1.0
Windows 10 Build Number:
App min and target version:
The text was updated successfully, but these errors were encountered: