This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Conversation
dhoehna
approved these changes
May 16, 2024
sshilov7
reviewed
May 17, 2024
sshilov7
reviewed
May 17, 2024
| { | ||
| collectionToUpdate.Add(listWithUpdates[i]); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
These loops fire OnCollectionChanged events for every operation which is inefficient and can make UX less responsive.
There is BulkObservableCollection class that has AddRange method and
BeginBulkOperation and EndBulkOperation methods that can be used to suspend notification while doing multiple changes to the collection.
Contributor
Author
There was a problem hiding this comment.
Using that requires adding the Microsoft.VisualStudio.Language.Intellisense nuget package so I don't think we want to add it this close to cut off. Luckily the amount of properties sent back by both the Hyper-V extension and Dev Box are small (4 for dev box and 5 for hyper-V). So I can investigate using the above nuget package after build
sshilov7
approved these changes
May 17, 2024
krschau
reviewed
May 17, 2024
EricJohnson327
pushed a commit
that referenced
this pull request
May 17, 2024
…ion (#2950) * update how we update the properties * fix ordering * update based on comments
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary of the pull request
This issue doesn't happen often but it is still an issue that can crash Dev Home which I observed. See: #2947
I explained the issue in point 1 in this PR: #2892
Basically, when you perform any action in the environments page, e.g Starting/Stopping the properties are updated because they may have changed as a result of the operation. In the issue I how the exception that can happen when we attempt to remove the old items from the observable collection. But because we go on add items to the collection afterwards we get an exception. As a minimal change I'm moving the loop that add new items to the observable collection to the try/catch. And then if there is an exception create a new observable collection with the new items. This will least allow the user to see the updated properties.
In the future I'd like to investigate why the observable collection is throwing but for build we can do this work around
References and relevant issues
Detailed description of the pull request / Additional comments
Validation steps performed
PR checklist