Skip to content

Commit f199169

Browse files
Remove thread requirement from CodeAnalysisDiagnosticAnalyzerService
This looks to be safely callable from any thread.
1 parent 9592f3a commit f199169

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
@@ -50,9 +50,7 @@ public CodeAnalysisDiagnosticAnalyzerService(
5050
_workspace = workspace;
5151
_diagnosticAnalyzerService = _workspace.Services.GetRequiredService<IDiagnosticAnalyzerService>();
5252

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

5856
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)