diff --git a/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs b/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs index 0cf2a98e170b..6429654a57c6 100644 --- a/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs +++ b/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs @@ -312,7 +312,14 @@ public ValueTask GetUpdatesAsync(CancellationToken canc [Obsolete] public ValueTask GetUpdatesAsync(ImmutableArray runningProjects, CancellationToken cancellationToken) - => throw new NotImplementedException(); + { + // StreamJsonRpc may use this overload when the method is invoked with empty parameters. Call the new implementation instead. + + if (!runningProjects.IsEmpty) + throw new NotImplementedException(); + + return GetUpdatesAsync(ImmutableArray.Empty, cancellationToken); + } public async ValueTask GetUpdatesAsync(ImmutableArray runningProjects, CancellationToken cancellationToken) { diff --git a/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageServiceBridge.cs b/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageServiceBridge.cs index a58f500f26dd..80b8038ef7e9 100644 --- a/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageServiceBridge.cs +++ b/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageServiceBridge.cs @@ -38,7 +38,14 @@ public ValueTask GetUpdatesAsync(CancellationToken canc [Obsolete] public ValueTask GetUpdatesAsync(ImmutableArray runningProjects, CancellationToken cancellationToken) - => throw new NotImplementedException(); + { + // StreamJsonRpc may use this overload when the method is invoked with empty parameters. Call the new implementation instead. + + if (!runningProjects.IsEmpty) + throw new NotImplementedException(); + + return GetUpdatesAsync(ImmutableArray.Empty, cancellationToken); + } public ValueTask GetUpdatesAsync(ImmutableArray runningProjects, CancellationToken cancellationToken) => service.GetUpdatesAsync(runningProjects, cancellationToken); diff --git a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs index b711c7f3475b..650609b224c1 100644 --- a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs @@ -319,6 +319,12 @@ await localWorkspace.ChangeSolutionAsync(localWorkspace.CurrentSolution Assert.True(sessionState.IsSessionActive); +#pragma warning disable CS0612 // Type or member is obsolete + // validate that obsolete overload does not throw for empty array: + _ = await localService.GetUpdatesAsync(runningProjects: ImmutableArray.Empty, CancellationToken.None); + Assert.Equal(++observedDiagnosticVersion, diagnosticRefresher.GlobalStateVersion); +#pragma warning restore + if (commitChanges) { // CommitUpdatesAsync