Skip to content

Conversation

@sharwell
Copy link
Contributor

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.

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.
@sharwell sharwell requested a review from a team as a code owner August 18, 2021 22:18
@ghost ghost added the Area-IDE label Aug 18, 2021
@davidwengier
Copy link
Member

I cherry-picked this and validated that this fixes the break in the new document formatting.

@sharwell sharwell enabled auto-merge August 18, 2021 22:31
@sharwell sharwell changed the title Implement PackageSettingsPersister.TryFetch 🐛 Implement PackageSettingsPersister.TryFetch Aug 19, 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can end up starting with the wrong value, but it doesn't really concern me for several reasons:

  1. 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.
  2. 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.
  3. 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.

@JoeRobich
Copy link
Member

Merging to fix blocking bug.

@JoeRobich JoeRobich disabled auto-merge August 19, 2021 23:19
@JoeRobich JoeRobich merged commit 439cd0e into dotnet:main Aug 19, 2021
@ghost ghost added this to the Next milestone Aug 19, 2021
@sharwell sharwell deleted the fix-settings-load branch August 20, 2021 00:16
@dibarbet dibarbet modified the milestones: Next, 17.0.P4 Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants