🐛 Implement PackageSettingsPersister.TryFetch#55709
Merged
JoeRobich merged 1 commit intodotnet:mainfrom Aug 19, 2021
Merged
Conversation
PackageSettingsPersister.InitializeAsync is not guaranteed to complete before the constructor returns, so it's possible for TryFetch to be called. This method is now implemented to provide a best-known value prior to initialization completing.
davidwengier
approved these changes
Aug 18, 2021
Member
|
I cherry-picked this and validated that this fixes the break in the new document formatting. |
dibarbet
approved these changes
Aug 18, 2021
| Contract.ThrowIfTrue(Equals(optionKey.Option, SolutionCrawlerOptions.SolutionBackgroundAnalysisScopeOption)); | ||
| // This option is refreshed via the constructor to avoid UI dependencies when retrieving option values. If | ||
| // we happen to reach this point before the value is available, try to obtain it without blocking, and | ||
| // otherwise fall back to the default. |
Contributor
There was a problem hiding this comment.
this is worrying to me as i really don't know what implications this has. can we end up just using an incorrect value that doesn't represent what the system wants?
Contributor
Author
There was a problem hiding this comment.
We can end up starting with the wrong value, but it doesn't really concern me for several reasons:
- The trigger for starting with the wrong state involves opening a document, and no matter what option is supposed to be used we know the open document is going to be analyzed.
- The fallback default is the default state for the IDE as a whole. This is a rarely-changed option, so for most users we start in the correct state no matter what.
- For the majority of cases where the current solution differs from the default state, the solution state includes more analysis content than the default, so even if the value starts out wrong the IDE will not reach a transient state on the way to steady-state where more diagnostics are shown than desired.
Member
|
Merging to fix blocking bug. |
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.
PackageSettingsPersister.InitializeAsyncis not guaranteed to complete before the constructor returns, so it's possible forTryFetchto be called. This method is now implemented to provide a best-known value prior to initialization completing.