Skip to content

Call InitializeTelemetrySession on background thread#58399

Merged
tmat merged 1 commit intodotnet:mainfrom
tmat:PackageInit2
Jan 5, 2022
Merged

Call InitializeTelemetrySession on background thread#58399
tmat merged 1 commit intodotnet:mainfrom
tmat:PackageInit2

Conversation

@tmat
Copy link
Copy Markdown
Member

@tmat tmat commented Dec 17, 2021

Fixes AB#1449211.

InitializeTelemetrySession accessed options which triggered assembly load that caused deadlock.

As per AB#296981, the TelemetryService.DefaultSession property must be accessed on UI thread but the rest of Roslyn telemetry service initialization can be run on background thread.

The change moves telemetry initialization to VisualStudioWorkspaceImpl, so that it does not depend on RoslynPackage being loaded.

@tmat tmat requested a review from a team as a code owner December 17, 2021 22:14
@ghost ghost added the Area-IDE label Dec 17, 2021
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

Slightly concerned about the lack of explicit option persister loading unless you now know that it's being triggered by somewhere else. But keeping it explicit would still be good I think.

@tmat
Copy link
Copy Markdown
Member Author

tmat commented Dec 18, 2021

Slightly concerned about the lack of explicit option persister loading unless you now know that it's being triggered by somewhere else. But keeping it explicit would still be good I think.

What does the explicit persister loading accomplish? It's loading in a fire and forget task on a background thread and there is no guarantee that other Roslyn code using options won't run before the explicit loading.

@tmat
Copy link
Copy Markdown
Member Author

tmat commented Dec 20, 2021

Slightly concerned about the lack of explicit option persister loading unless you now know that it's being triggered by somewhere else. But keeping it explicit would still be good I think.

What does the explicit persister loading accomplish? It's loading in a fire and forget task on a background thread and there is no guarantee that other Roslyn code using options won't run before the explicit loading.

Was the intention a best effort (w/o guarantee) to move loading assemblies off of UI thread, in case someone accesses the option service for the first time on UI thread?

@tmat
Copy link
Copy Markdown
Member Author

tmat commented Jan 5, 2022

@jasonmalinowski Reverted removal of option providers pre-loading to lower risk.

@tmat tmat enabled auto-merge (squash) January 5, 2022 05:52
@tmat tmat merged commit a9cdf7f into dotnet:main Jan 5, 2022
@ghost ghost added this to the Next milestone Jan 5, 2022
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