From 616fc283e903e534fc878538ea8bca99b41fd459 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 14 Mar 2024 19:20:29 -0700 Subject: [PATCH] Remove stale test --- .../DiagnosticAnalyzerServiceTests.cs | 75 ------------------- 1 file changed, 75 deletions(-) diff --git a/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs b/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs index a366b436a54c9..ec4590845f359 100644 --- a/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs @@ -942,81 +942,6 @@ void M() } } - [Theory, CombinatorialData] - internal async Task TestCancellationDuringDiagnosticComputation_InProc(AnalyzerRegisterActionKind actionKind) - { - // This test verifies that we do no attempt to re-use CompilationWithAnalyzers instance in IDE in-proc diagnostic computation in presence of an OperationCanceledException during analysis. - // Attempting to do so has led to large number of reliability issues and flakiness in diagnostic computation, which we want to avoid. - - var source = @" -class A -{ - void M() - { - int x = 0; - } -}"; - - using var workspace = EditorTestWorkspace.CreateCSharp(source, - composition: s_editorFeaturesCompositionWithMockDiagnosticUpdateSourceRegistrationService.AddParts(typeof(TestDocumentTrackingService))); - Assert.True(workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions( - workspace.CurrentSolution.Options.WithChangedOption(new OptionKey(DiagnosticOptionsStorage.PullDiagnosticsFeatureFlag), false)))); - - var analyzer = new CancellationTestAnalyzer(actionKind); - var analyzerReference = new AnalyzerImageReference(ImmutableArray.Create(analyzer)); - workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences(new[] { analyzerReference })); - - var project = workspace.CurrentSolution.Projects.Single(); - var document = project.Documents.Single(); - - Assert.IsType(workspace.GetService()); - var service = Assert.IsType(workspace.GetService()); - var globalOptions = workspace.GetService(); - - DiagnosticData diagnostic = null; - service.DiagnosticsUpdated += (s, eCollection) => - { - foreach (var e in eCollection) - { - var diagnostics = e.Diagnostics; - if (diagnostics.IsEmpty) - { - continue; - } - - Assert.Null(diagnostic); - diagnostic = Assert.Single(diagnostics); - } - }; - - var incrementalAnalyzer = service.CreateIncrementalAnalyzer(workspace); - - OpenDocumentAndMakeActive(document, workspace); - - // First invoke analysis with cancellation token, and verify canceled compilation and no reported diagnostics. - Assert.Empty(analyzer.CanceledCompilations); - try - { - await incrementalAnalyzer.ForceAnalyzeProjectAsync(project, analyzer.CancellationToken); - - throw ExceptionUtilities.Unreachable(); - } - catch (OperationCanceledException ex) when (ex.CancellationToken == analyzer.CancellationToken) - { - } - - Assert.Single(analyzer.CanceledCompilations); - Assert.Null(diagnostic); - - // Then invoke analysis without cancellation token, and verify non-cancelled diagnostic. - await incrementalAnalyzer.ForceAnalyzeProjectAsync(project, CancellationToken.None); - - await ((AsynchronousOperationListener)service.Listener).ExpeditedWaitAsync(); - - Assert.True(diagnostic != null); - Assert.Equal(CancellationTestAnalyzer.DiagnosticId, diagnostic.Id); - } - [Theory, CombinatorialData] [WorkItem("https://github.com/dotnet/roslyn/issues/49698")] internal async Task TestOnlyRequiredAnalyzerExecutedDuringDiagnosticComputation(bool documentAnalysis)