Automatically dispatch CollectionChanged notification to the UI thread - #22160
Open
jjkh wants to merge 2 commits into
Open
Automatically dispatch CollectionChanged notification to the UI thread#22160jjkh wants to merge 2 commits into
jjkh wants to merge 2 commits into
Conversation
Author
|
Oops, this is a breaking change with the public I'm not sure what's best to do here - I changed the name to match |
Collaborator
|
Author
|
@cla-avalonia agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
This PR makes two changes to address crashes found in local testing:
WeakEvents.CollectionChangedthread-safe by posting to the UI threadPropertyChangedin Automatically dispatch PropertyChanged notification to the UI thread #10362CanExecuteChangedevent to the UI thread #20729ConcurrentStackrather thanStackforWeakHashList's staticPooledListpoolCollectionChangedevents for different collections, they could both pop the samePooledListfrom the pool, causing the samePooledListto be used by two threads at onceWhat is the current behavior?
Given the following test program:
We get the following exceptions:
What is the updated/expected behavior with this PR?
With the changes from this PR, I am no longer able to reproduce the exceptions above.
Automated Testing
Because these exceptions require a thread race to reproduce, I'm not sure how to reliably test them in CI.
I have omitted tests for now -- please let me know if they're required.