-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move more package initialization to BG. #60211
Conversation
src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs
Outdated
Show resolved
Hide resolved
@jasonmalinowski PTAL when you have a chance. Thanks! |
src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs
Show resolved
Hide resolved
var reporter = crawlerService.GetProgressReporter(workspace); | ||
public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) | ||
{ | ||
_taskCenterService = await serviceProvider.GetServiceAsync<SVsTaskStatusCenterService, IVsTaskStatusCenterService>().ConfigureAwait(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Make sure this line is not using the GetServiceAsync
extension method provided by the VS SDK (it relies on ThreadHelper
internally which is incompatible with testing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AArnott ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's true that it relies on ThreadHelper
. If you're not using the vssdktestfx or something similar to make ThreadHelper work, then ya, this will probably render you code unable to run in your unit tests.
src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs
Outdated
Show resolved
Hide resolved
var solution = await serviceProvider.GetServiceAsync<SVsSolution, IVsSolution>().ConfigureAwait(false); | ||
await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Reverse the order of these two lines, and use ConfigureAwait(true)
(fewer context switches on average).
But won't that request the service on the UI thread, which is what we're trying to avoid since it can cause UI-thread mef loads? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing major, but a few odd looking spots.
src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs
Outdated
Show resolved
Hide resolved
...Studio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs
Show resolved
Hide resolved
...Studio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs
Show resolved
Hide resolved
0e8cc49
to
7e14340
Compare
Fixes AB#1501477