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.
📝 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.
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.
📝 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? |
jasonmalinowski
left a comment
There was a problem hiding this comment.
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