Skip to content

Commit c6c55d5

Browse files
Remove thread requirement from CodeAnalysisDiagnosticAnalyzerService
This looks to be safely callable from any thread.
1 parent 92ec31e commit c6c55d5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Features/Core/Portable/Diagnostics/CodeAnalysisDiagnosticAnalyzerService.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ public CodeAnalysisDiagnosticAnalyzerService(
4949
_workspace = workspace;
5050
_diagnosticAnalyzerService = _workspace.Services.GetRequiredService<IDiagnosticAnalyzerService>();
5151

52-
// Main thread as OnWorkspaceChanged's call to IDiagnosticAnalyzerService.RequestDiagnosticRefresh isn't clear on
53-
// threading requirements
54-
_ = workspace.RegisterWorkspaceChangedHandler(OnWorkspaceChanged, WorkspaceEventOptions.RequiresMainThreadOptions);
52+
_ = workspace.RegisterWorkspaceChangedHandler(OnWorkspaceChanged);
5553
}
5654

5755
private void OnWorkspaceChanged(WorkspaceChangeEventArgs e)

src/Features/Core/Portable/Diagnostics/IDiagnosticAnalyzerService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ internal interface IDiagnosticAnalyzerService : IWorkspaceService
2222
/// <summary>
2323
/// Re-analyze all projects and documents. This will cause an LSP diagnostic refresh request to be sent.
2424
/// </summary>
25+
/// <remarks>
26+
/// This implementation must be safe to call on any thread.
27+
/// </remarks>
2528
void RequestDiagnosticRefresh();
2629

2730
/// <summary>

0 commit comments

Comments
 (0)