From 3a9f2a247db1ff21024653a0fdc37e3fc55f39fa Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 21 Sep 2022 15:27:58 -0700 Subject: [PATCH 01/13] Disable unused functionality --- .../UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs | 2 ++ .../SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs | 2 ++ ...gWorkCoordinator.UnitTestingNormalPriorityProcessor.cs | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index 2475f8168c634..b0427050ea821 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -40,8 +40,10 @@ public Task DocumentResetAsync(Document document, CancellationToken cancellation public Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken cancellationToken) => Task.CompletedTask; +#if false // Not used in unit testing crawling public Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken) => Task.CompletedTask; +#endif public Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken) { diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs index 85e05a9b514b9..ed7ff1e684605 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs @@ -11,7 +11,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler { internal interface IUnitTestingIncrementalAnalyzer { +#if false // Not used in unit testing crawling Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken); +#endif Task DocumentOpenAsync(Document document, CancellationToken cancellationToken); Task DocumentCloseAsync(Document document, CancellationToken cancellationToken); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index ae21ab6d3a41c..273321fd4358c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -519,19 +519,21 @@ private static async Task RemoveDocumentAsync(ImmutableArray a.NewSolutionSnapshotAsync(s, c), CancellationToken).ConfigureAwait(false); +#endif #if false // Not used in unit testing crawling foreach (var id in Processor.GetOpenDocumentIds()) @@ -547,6 +549,8 @@ await Processor.RunAnalyzersAsync( throw ExceptionUtilities.Unreachable; } + return Task.CompletedTask; + bool IsSolutionChanged() { var currentSolution = Processor._registration.GetSolutionToAnalyze(); From b87d6a5cbfb200e550277ebe7fe938dfc32a7a6f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 21 Sep 2022 15:30:48 -0700 Subject: [PATCH 02/13] Disable unused functionality --- .../UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs | 4 ++++ .../SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs | 5 ++++- ...tingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index b0427050ea821..64d091bbe9d43 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -28,11 +28,13 @@ public Task AnalyzeProjectAsync(Project project, bool semanticsChanged, UnitTest public Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => _implementation.AnalyzeSyntaxAsync(document, reasons, cancellationToken); +#if false // Not used in unit testing crawling public Task DocumentCloseAsync(Document document, CancellationToken cancellationToken) => Task.CompletedTask; public Task DocumentOpenAsync(Document document, CancellationToken cancellationToken) => Task.CompletedTask; +#endif public Task DocumentResetAsync(Document document, CancellationToken cancellationToken) => Task.CompletedTask; @@ -54,11 +56,13 @@ public Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancell public Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken) => Task.CompletedTask; +#if false // Not used in unit testing crawling public Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken) => Task.CompletedTask; public Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken) => Task.CompletedTask; +#endif public Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken) => Task.CompletedTask; diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs index ed7ff1e684605..a501e1af946ff 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs @@ -13,10 +13,11 @@ internal interface IUnitTestingIncrementalAnalyzer { #if false // Not used in unit testing crawling Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken); -#endif Task DocumentOpenAsync(Document document, CancellationToken cancellationToken); Task DocumentCloseAsync(Document document, CancellationToken cancellationToken); +#endif + Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken cancellationToken); /// @@ -31,8 +32,10 @@ internal interface IUnitTestingIncrementalAnalyzer Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken); Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken); +#if false // Not used in unit testing crawling Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken); Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken); +#endif /// /// Resets all the document state cached by the analyzer. diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index 273321fd4358c..93306cf09bd07 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -342,6 +342,7 @@ private async Task ProcessDocumentAsync(ImmutableArray analyzers, UnitTestingWorkItem workItem, TextDocument textDocument, bool isOpen, CancellationToken cancellationToken) { if (!isOpen || !workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.DocumentOpened)) @@ -442,6 +445,7 @@ static async Task DocumentCloseAsync(IUnitTestingIncrementalAnalyzer analyzer, T } } } +#endif private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, TextDocument document, CancellationToken cancellationToken) { From 46b5344d6fc76f43fe50eef6bf6bccea581e1fcc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 21 Sep 2022 15:36:30 -0700 Subject: [PATCH 03/13] Disable unused functionality --- .../UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs | 4 +--- .../SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs | 4 ++-- ...rkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs | 6 ++++-- ...ingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index 64d091bbe9d43..88be8dfa4a918 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -34,7 +34,6 @@ public Task DocumentCloseAsync(Document document, CancellationToken cancellation public Task DocumentOpenAsync(Document document, CancellationToken cancellationToken) => Task.CompletedTask; -#endif public Task DocumentResetAsync(Document document, CancellationToken cancellationToken) => Task.CompletedTask; @@ -42,7 +41,6 @@ public Task DocumentResetAsync(Document document, CancellationToken cancellation public Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken cancellationToken) => Task.CompletedTask; -#if false // Not used in unit testing crawling public Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken) => Task.CompletedTask; #endif @@ -62,10 +60,10 @@ public Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationTo public Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken) => Task.CompletedTask; -#endif public Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken) => Task.CompletedTask; +#endif public Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => Task.CompletedTask; diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs index a501e1af946ff..69dd2a64e5c34 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs @@ -16,7 +16,6 @@ internal interface IUnitTestingIncrementalAnalyzer Task DocumentOpenAsync(Document document, CancellationToken cancellationToken); Task DocumentCloseAsync(Document document, CancellationToken cancellationToken); -#endif Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken cancellationToken); @@ -24,6 +23,7 @@ internal interface IUnitTestingIncrementalAnalyzer /// Resets all the document state cached by the analyzer. /// Task DocumentResetAsync(Document document, CancellationToken cancellationToken); +#endif Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); Task AnalyzeDocumentAsync(Document document, SyntaxNode bodyOpt, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); @@ -35,12 +35,12 @@ internal interface IUnitTestingIncrementalAnalyzer #if false // Not used in unit testing crawling Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken); Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken); -#endif /// /// Resets all the document state cached by the analyzer. /// Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken); +#endif Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index 15de62804ace0..9fa486e4c1202 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -176,7 +176,7 @@ private async Task ProcessDocumentAnalyzersAsync( TextDocument textDocument, ImmutableArray analyzers, UnitTestingWorkItem workItem, CancellationToken cancellationToken) { // process special active document switched request, if any. - if (await ProcessActiveDocumentSwitchedAsync(analyzers, workItem, textDocument, cancellationToken).ConfigureAwait(false)) + if (ProcessActiveDocumentSwitched(analyzers, workItem, textDocument, cancellationToken)) { return; } @@ -220,7 +220,7 @@ static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, T } } - async Task ProcessActiveDocumentSwitchedAsync(ImmutableArray analyzers, UnitTestingWorkItem workItem, TextDocument document, CancellationToken cancellationToken) + bool ProcessActiveDocumentSwitched(ImmutableArray analyzers, UnitTestingWorkItem workItem, TextDocument document, CancellationToken cancellationToken) { try { @@ -229,8 +229,10 @@ async Task ProcessActiveDocumentSwitchedAsync(ImmutableArray analyzer.ActiveDocumentSwitchedAsync(document, cancellationToken), cancellationToken).ConfigureAwait(false); +#endif return true; } catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken)) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index 93306cf09bd07..b864cd8c19b5f 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -463,7 +463,9 @@ private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, T // First reset the document state in analyzers. var reanalyzers = workItem.SpecificAnalyzers.ToImmutableArray(); +#if false // Not used in unit testing crawling await Processor.RunAnalyzersAsync(reanalyzers, document, workItem, DocumentResetAsync, cancellationToken).ConfigureAwait(false); +#endif // No request to re-run syntax change analysis. run it here var reasons = workItem.InvocationReasons; @@ -487,6 +489,7 @@ private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, T return; +#if false // Not used in unit testing crawling static async Task DocumentResetAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, CancellationToken cancellationToken) { if (textDocument is Document document) @@ -498,6 +501,7 @@ static async Task DocumentResetAsync(IUnitTestingIncrementalAnalyzer analyzer, T await analyzer.NonSourceDocumentResetAsync(textDocument, cancellationToken).ConfigureAwait(false); } } +#endif static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) { From ae0d3335ea9229ef0d787467de9d6f7e7793af09 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 21 Sep 2022 15:39:12 -0700 Subject: [PATCH 04/13] Disable unused functionality --- .../UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs | 4 ++-- .../SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs | 5 +++-- ...orkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs | 2 ++ ...TestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs | 4 ++++ ...tingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs | 2 ++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index 88be8dfa4a918..932d972f94d08 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -51,10 +51,10 @@ public Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancell return Task.CompletedTask; } +#if false // Not used in unit testing crawling public Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken) => Task.CompletedTask; -#if false // Not used in unit testing crawling public Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken) => Task.CompletedTask; @@ -63,10 +63,10 @@ public Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationT public Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken) => Task.CompletedTask; -#endif public Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => Task.CompletedTask; +#endif public void LogAnalyzerCountSummary() { diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs index 69dd2a64e5c34..1e980567c6de8 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs @@ -30,9 +30,10 @@ internal interface IUnitTestingIncrementalAnalyzer Task AnalyzeProjectAsync(Project project, bool semanticsChanged, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken); - Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken); #if false // Not used in unit testing crawling + Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken); + Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken); Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken); @@ -40,9 +41,9 @@ internal interface IUnitTestingIncrementalAnalyzer /// Resets all the document state cached by the analyzer. /// Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken); -#endif Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); +#endif void LogAnalyzerCountSummary(); int Priority { get; } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index 9fa486e4c1202..6d27cfc8538fd 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -216,7 +216,9 @@ static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, T } else { +#if false // Not used in unit testing crawling await analyzer.AnalyzeNonSourceDocumentAsync(textDocument, reasons, cancellationToken).ConfigureAwait(false); +#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs index d17227fd51fbf..d2d91e2db326f 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs @@ -156,7 +156,9 @@ private async Task ProcessProjectAsync(ImmutableArray Date: Wed, 21 Sep 2022 15:41:20 -0700 Subject: [PATCH 05/13] Disable unused functionality --- .../UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs | 3 ++- .../SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs | 2 +- .../SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs | 2 ++ ...tingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs | 2 ++ ...gWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index 932d972f94d08..c88401ce08e12 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -66,7 +66,6 @@ public Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationT public Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => Task.CompletedTask; -#endif public void LogAnalyzerCountSummary() { @@ -88,5 +87,7 @@ public void LogAnalyzerCountSummary() public void Shutdown() { } + +#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs index 1e980567c6de8..7ddb11b153157 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs @@ -43,10 +43,10 @@ internal interface IUnitTestingIncrementalAnalyzer Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken); Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); -#endif void LogAnalyzerCountSummary(); int Priority { get; } void Shutdown(); +#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs index f96e6f74ec69f..f05a086bd5c1b 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs @@ -219,10 +219,12 @@ public static void LogIncrementalAnalyzerProcessorStatistics(int correlationId, } })); +#if false // Not used in unit testing crawling foreach (var analyzer in analyzers) { analyzer.LogAnalyzerCountSummary(); } +#endif } private static int GetSolutionHash(Solution solution) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs index 6c548df36abeb..00c7cc7ecb582 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs @@ -124,10 +124,12 @@ public override void Shutdown() Processor._documentTracker.NonRoslynBufferTextChanged -= OnNonRoslynBufferTextChanged; +#if false // Not used in unit testing crawling foreach (var analyzer in Analyzers) { analyzer.Shutdown(); } +#endif } private void OnNonRoslynBufferTextChanged(object? sender, EventArgs e) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index 6d27cfc8538fd..643ef13eea7a9 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -428,7 +428,9 @@ public ImmutableArray GetOrderedAnalyzers(strin // Sort list so DiagnosticIncrementalAnalyzers (if any) come first. analyzers = _analyzerProviders.Select(p => (analyzer: p.Value.CreateIncrementalAnalyzer(), highPriorityForActiveFile: p.Metadata.HighPriorityForActiveFile)) .Where(t => t.analyzer != null) +#if false // Not used in unit testing crawling .OrderBy(t => t.analyzer!.Priority) +#endif .ToImmutableArray()!; _analyzerMap[(workspaceKind, services)] = analyzers; From 8949601645032a705732a11fd4be23ec56fb8497 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 21 Sep 2022 15:59:35 -0700 Subject: [PATCH 06/13] Disable unused functionality --- ...wUnitTestingIncrementalAnalyzerProvider.cs | 2 ++ ...ingIncrementalAnalyzerProviderAttribute.cs | 6 ++++ ...tingIncrementalAnalyzerProviderMetadata.cs | 17 +++++++++- ...stingSolutionCrawlerRegistrationService.cs | 6 +++- ...inator.UnitTestingHighPriorityProcessor.cs | 2 ++ ...UnitTestingIncrementalAnalyzerProcessor.cs | 33 ++++++++++++++++--- .../UnitTestingWorkCoordinator.cs | 14 ++++++-- 7 files changed, 72 insertions(+), 8 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs index 77d5a8b71253e..da51d3ecdebfc 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs @@ -53,7 +53,9 @@ public void Reanalyze() var metadata = new UnitTestingIncrementalAnalyzerProviderMetadata( analyzerName, +#if false // Not used in unit testing crawling highPriorityForActiveFile: false, +#endif new[] { workspaceKind }); solutionCrawlerRegistrationService.AddAnalyzerProvider(analyzerProvider, metadata); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs index 6d00dcba601f4..2d998df1a3f10 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs @@ -13,7 +13,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler [AttributeUsage(AttributeTargets.Class)] internal class ExportUnitTestingIncrementalAnalyzerProviderAttribute : ExportAttribute { +#if false // Not used in unit testing crawling public bool HighPriorityForActiveFile { get; } +#endif public string Name { get; } public string[] WorkspaceKinds { get; } @@ -22,13 +24,17 @@ public ExportUnitTestingIncrementalAnalyzerProviderAttribute(string name, string { this.WorkspaceKinds = workspaceKinds; this.Name = name ?? throw new ArgumentNullException(nameof(name)); +#if false // Not used in unit testing crawling this.HighPriorityForActiveFile = false; +#endif } public ExportUnitTestingIncrementalAnalyzerProviderAttribute(bool highPriorityForActiveFile, string name, string[] workspaceKinds) : this(name, workspaceKinds) { +#if false // Not used in unit testing crawling this.HighPriorityForActiveFile = highPriorityForActiveFile; +#endif } } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs index a6f70f01d5504..24bdb9e560d8c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs @@ -12,20 +12,31 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler { internal class UnitTestingIncrementalAnalyzerProviderMetadata : WorkspaceKindMetadata { +#if false // Not used in unit testing crawling public bool HighPriorityForActiveFile { get; } +#endif public string Name { get; } public UnitTestingIncrementalAnalyzerProviderMetadata(IDictionary data) : base(data) { +#if false // Not used in unit testing crawling this.HighPriorityForActiveFile = (bool)data.GetValueOrDefault("HighPriorityForActiveFile"); +#endif this.Name = (string)data.GetValueOrDefault("Name"); } - public UnitTestingIncrementalAnalyzerProviderMetadata(string name, bool highPriorityForActiveFile, params string[] workspaceKinds) + public UnitTestingIncrementalAnalyzerProviderMetadata( + string name, +#if false // Not used in unit testing crawling + bool highPriorityForActiveFile, +#endif + params string[] workspaceKinds) : base(workspaceKinds) { +#if false // Not used in unit testing crawling this.HighPriorityForActiveFile = highPriorityForActiveFile; +#endif this.Name = name; } @@ -33,7 +44,9 @@ public override bool Equals(object obj) { return obj is UnitTestingIncrementalAnalyzerProviderMetadata metadata && base.Equals(obj) +#if false // Not used in unit testing crawling && HighPriorityForActiveFile == metadata.HighPriorityForActiveFile +#endif && Name == metadata.Name; } @@ -41,7 +54,9 @@ public override int GetHashCode() { var hashCode = 1997033996; hashCode = hashCode * -1521134295 + base.GetHashCode(); +#if false // Not used in unit testing crawling hashCode = hashCode * -1521134295 + HighPriorityForActiveFile.GetHashCode(); +#endif hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Name); return hashCode; } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs index 3487346027892..3de73550b98bc 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs @@ -130,7 +130,11 @@ public void AddAnalyzerProvider(IUnitTestingIncrementalAnalyzerProvider provider var analyzer = lazyProvider.Value.CreateIncrementalAnalyzer(); if (analyzer != null) { - coordinator.AddAnalyzer(analyzer, metadata.HighPriorityForActiveFile); + coordinator.AddAnalyzer(analyzer +#if false // Not used in unit testing crawling + , metadata.HighPriorityForActiveFile +#endif + ); } } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs index 785ceac8a3703..8f917d45bf1c7 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs @@ -95,11 +95,13 @@ public void Enqueue(UnitTestingWorkItem item) return; } +#if false // Not used in unit testing crawling if (!_processor._documentTracker.SupportsDocumentTracking && _processor._registration.WorkspaceKind is WorkspaceKind.RemoteWorkspace) { Debug.Fail($"Unexpected use of '{nameof(ExportUnitTestingIncrementalAnalyzerProviderAttribute.HighPriorityForActiveFile)}' in workspace kind '{_processor._registration.WorkspaceKind}' that cannot support active file tracking."); } +#endif // check whether given item is for active document, otherwise, nothing to do here if (_processor._documentTracker.TryGetActiveDocument() != item.DocumentId) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index 643ef13eea7a9..1df7155c9b47a 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -119,12 +119,19 @@ public void Enqueue(UnitTestingWorkItem item) ReportPendingWorkItemCount(); } - public void AddAnalyzer(IUnitTestingIncrementalAnalyzer analyzer, bool highPriorityForActiveFile) + public void AddAnalyzer( + IUnitTestingIncrementalAnalyzer analyzer +#if false // Not used in unit testing crawling + , bool highPriorityForActiveFile +#endif + ) { +#if false // Not used in unit testing crawling if (highPriorityForActiveFile) { _highPriorityProcessor.AddAnalyzer(analyzer); } +#endif _normalPriorityProcessor.AddAnalyzer(analyzer); _lowPriorityProcessor.AddAnalyzer(analyzer); @@ -412,7 +419,13 @@ public void Dispose() { } private class UnitTestingAnalyzersGetter { private readonly List> _analyzerProviders; - private readonly Dictionary<(string workspaceKind, SolutionServices services), ImmutableArray<(IUnitTestingIncrementalAnalyzer analyzer, bool highPriorityForActiveFile)>> _analyzerMap = new(); + private readonly Dictionary<(string workspaceKind, SolutionServices services), ImmutableArray< +#if false // Not used in unit testing crawling + (IUnitTestingIncrementalAnalyzer analyzer, bool highPriorityForActiveFile) +#else + IUnitTestingIncrementalAnalyzer +#endif + >> _analyzerMap = new(); public UnitTestingAnalyzersGetter(IEnumerable> analyzerProviders) { @@ -425,25 +438,37 @@ public ImmutableArray GetOrderedAnalyzers(strin { if (!_analyzerMap.TryGetValue((workspaceKind, services), out var analyzers)) { + analyzers = _analyzerProviders + .Select(p => p.Value.CreateIncrementalAnalyzer()) + .WhereNotNull() + .ToImmutableArray(); +#if false // Not used in unit testing crawling // Sort list so DiagnosticIncrementalAnalyzers (if any) come first. analyzers = _analyzerProviders.Select(p => (analyzer: p.Value.CreateIncrementalAnalyzer(), highPriorityForActiveFile: p.Metadata.HighPriorityForActiveFile)) .Where(t => t.analyzer != null) -#if false // Not used in unit testing crawling .OrderBy(t => t.analyzer!.Priority) -#endif .ToImmutableArray()!; +#endif _analyzerMap[(workspaceKind, services)] = analyzers; } if (onlyHighPriorityAnalyzer) { +#if false // Not used in unit testing crawling // include only high priority analyzer for active file return analyzers.SelectAsArray(t => t.highPriorityForActiveFile, t => t.analyzer); +#else + return ImmutableArray.Empty; +#endif } +#if false // Not used in unit testing crawling // return all analyzers return analyzers.Select(t => t.analyzer).ToImmutableArray(); +#else + return analyzers; +#endif } } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs index 13ed4df6989b5..01546c2df6b0b 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs @@ -74,10 +74,20 @@ public UnitTestingWorkCoordinator( public UnitTestingRegistration Registration => _registration; public int CorrelationId => _registration.CorrelationId; - public void AddAnalyzer(IUnitTestingIncrementalAnalyzer analyzer, bool highPriorityForActiveFile) + public void AddAnalyzer( + IUnitTestingIncrementalAnalyzer analyzer +#if false // Not used in unit testing crawling + , bool highPriorityForActiveFile +#endif + ) { // add analyzer - _documentAndProjectWorkerProcessor.AddAnalyzer(analyzer, highPriorityForActiveFile); + _documentAndProjectWorkerProcessor.AddAnalyzer( + analyzer +#if false // Not used in unit testing crawling + , highPriorityForActiveFile +#endif + ); // and ask to re-analyze whole solution for the given analyzer var scope = new UnitTestingReanalyzeScope(_registration.GetSolutionToAnalyze().Id); From 6c0f7ced48c1194ac7d7f58e432936e3c19db6b3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 21 Sep 2022 16:21:47 -0700 Subject: [PATCH 07/13] Remove priority concept --- ...stingSolutionCrawlerRegistrationService.cs | 2 ++ ...inator.UnitTestingHighPriorityProcessor.cs | 2 ++ ...UnitTestingIncrementalAnalyzerProcessor.cs | 22 ++++++++++++++++++- ...dinator.UnitTestingLowPriorityProcessor.cs | 10 ++++++++- ...ator.UnitTestingNormalPriorityProcessor.cs | 8 +++++++ .../UnitTestingWorkCoordinator.cs | 14 ++++++++++-- 6 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs index 3de73550b98bc..7a67f841b3ead 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs @@ -70,7 +70,9 @@ public IUnitTestingWorkCoordinator Register(Solution solution) coordinator = new UnitTestingWorkCoordinator( _listener, GetAnalyzerProviders(workspaceKind), +#if false // Not used in unit testing crawling initializeLazily: true, +#endif new UnitTestingRegistration(this, correlationId, workspaceKind, solutionServices, _progressReporter)); _documentWorkCoordinatorMap.Add((workspaceKind, solutionServices), coordinator); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs index 8f917d45bf1c7..2ec22c7b074de 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs @@ -20,6 +20,7 @@ internal sealed partial class UnitTestingWorkCoordinator { private sealed partial class UnitTestingIncrementalAnalyzerProcessor { +#if false // Not used in unit testing crawling private sealed class UnitTestingHighPriorityProcessor : UnitTestingIdleProcessor { private readonly UnitTestingIncrementalAnalyzerProcessor _processor; @@ -236,6 +237,7 @@ private async Task ProcessDocumentAsync(Solution solution, ImmutableArray _workItemQueue.Dispose(); } +#endif } } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index 1df7155c9b47a..f3a73dfe77953 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -35,7 +35,9 @@ private partial class UnitTestingIncrementalAnalyzerProcessor private readonly IUnitTestingDocumentTrackingService _documentTracker; private readonly IProjectCacheService? _cacheService; +#if false // Not used in unit testing crawling private readonly UnitTestingHighPriorityProcessor _highPriorityProcessor; +#endif private readonly UnitTestingNormalPriorityProcessor _normalPriorityProcessor; private readonly UnitTestingLowPriorityProcessor _lowPriorityProcessor; @@ -53,7 +55,9 @@ private partial class UnitTestingIncrementalAnalyzerProcessor public UnitTestingIncrementalAnalyzerProcessor( IAsynchronousOperationListener listener, IEnumerable> analyzerProviders, +#if false // Not used in unit testing crawling bool initializeLazily, +#endif UnitTestingRegistration registration, TimeSpan highBackOffTimeSpan, TimeSpan normalBackOffTimeSpan, @@ -71,22 +75,28 @@ public UnitTestingIncrementalAnalyzerProcessor( var analyzersGetter = new UnitTestingAnalyzersGetter(analyzerProviders); // create analyzers lazily. +#if false // Not used in unit testing crawling var lazyActiveFileAnalyzers = new Lazy>(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: true)); +#endif var lazyAllAnalyzers = new Lazy>(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: false)); +#if false // Not used in unit testing crawling if (!initializeLazily) { // realize all analyzer right away _ = lazyActiveFileAnalyzers.Value; _ = lazyAllAnalyzers.Value; } +#endif // event and worker queues _documentTracker = _registration.Services.GetRequiredService(); var globalNotificationService = _registration.Services.GetRequiredService(); +#if false // Not used in unit testing crawling _highPriorityProcessor = new UnitTestingHighPriorityProcessor(listener, this, lazyActiveFileAnalyzers, highBackOffTimeSpan, shutdownToken); +#endif _normalPriorityProcessor = new UnitTestingNormalPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, normalBackOffTimeSpan, shutdownToken); _lowPriorityProcessor = new UnitTestingLowPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, lowBackOffTimeSpan, shutdownToken); } @@ -112,7 +122,9 @@ public void Enqueue(UnitTestingWorkItem item) { Contract.ThrowIfNull(item.DocumentId); +#if false // Not used in unit testing crawling _highPriorityProcessor.Enqueue(item); +#endif _normalPriorityProcessor.Enqueue(item); _lowPriorityProcessor.Enqueue(item); @@ -139,7 +151,9 @@ IUnitTestingIncrementalAnalyzer analyzer public void Shutdown() { +#if false // Not used in unit testing crawling _highPriorityProcessor.Shutdown(); +#endif _normalPriorityProcessor.Shutdown(); _lowPriorityProcessor.Shutdown(); } @@ -156,7 +170,9 @@ public Task AsyncProcessorTask get { return Task.WhenAll( +#if false // Not used in unit testing crawling _highPriorityProcessor.AsyncProcessorTask, +#endif _normalPriorityProcessor.AsyncProcessorTask, _lowPriorityProcessor.AsyncProcessorTask); } @@ -175,7 +191,11 @@ private void ResetLogAggregator() private void ReportPendingWorkItemCount() { - var pendingItemCount = _highPriorityProcessor.WorkItemCount + _normalPriorityProcessor.WorkItemCount + _lowPriorityProcessor.WorkItemCount; + var pendingItemCount = +#if false // Not used in unit testing crawling + _highPriorityProcessor.WorkItemCount + +#endif + _normalPriorityProcessor.WorkItemCount + _lowPriorityProcessor.WorkItemCount; _registration.ProgressReporter.UpdatePendingItemCount(pendingItemCount); } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs index d2d91e2db326f..cd10c5c2fe8ac 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs @@ -77,7 +77,11 @@ protected override Task HigherQueueOperationTask { get { +#if false // Not used in unit testing crawling return Task.WhenAll(Processor._highPriorityProcessor.Running, Processor._normalPriorityProcessor.Running); +#else + return Processor._normalPriorityProcessor.Running; +#endif } } @@ -85,7 +89,11 @@ protected override bool HigherQueueHasWorkItem { get { - return Processor._highPriorityProcessor.HasAnyWork || Processor._normalPriorityProcessor.HasAnyWork; + return +#if false // Not used in unit testing crawling + Processor._highPriorityProcessor.HasAnyWork || +#endif + Processor._normalPriorityProcessor.HasAnyWork; } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index 82c0893a44a8b..56366ca4ce4cf 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -190,20 +190,28 @@ protected override async Task ExecuteAsync() } protected override Task HigherQueueOperationTask +#if false // Not used in unit testing crawling { get { return Processor._highPriorityProcessor.Running; } } +#else + => Task.CompletedTask; +#endif protected override bool HigherQueueHasWorkItem +#if false // Not used in unit testing crawling { get { return Processor._highPriorityProcessor.HasAnyWork; } } +#else + => false; +#endif protected override void OnPaused() { diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs index 01546c2df6b0b..b12750b95a28d 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs @@ -40,7 +40,9 @@ internal sealed partial class UnitTestingWorkCoordinator : IUnitTestingWorkCoord public UnitTestingWorkCoordinator( IAsynchronousOperationListener listener, IEnumerable> analyzerProviders, +#if false // Not used in unit testing crawling bool initializeLazily, +#endif UnitTestingRegistration registration) { _registration = registration; @@ -59,8 +61,16 @@ public UnitTestingWorkCoordinator( var entireProjectWorkerBackOffTimeSpan = UnitTestingSolutionCrawlerTimeSpan.EntireProjectWorkerBackOff; _documentAndProjectWorkerProcessor = new UnitTestingIncrementalAnalyzerProcessor( - listener, analyzerProviders, initializeLazily, _registration, - activeFileBackOffTimeSpan, allFilesWorkerBackOffTimeSpan, entireProjectWorkerBackOffTimeSpan, _shutdownToken); + listener, + analyzerProviders, +#if false // Not used in unit testing crawling + initializeLazily, +#endif + _registration, + activeFileBackOffTimeSpan, + allFilesWorkerBackOffTimeSpan, + entireProjectWorkerBackOffTimeSpan, + _shutdownToken); var semanticBackOffTimeSpan = UnitTestingSolutionCrawlerTimeSpan.SemanticChangeBackOff; var projectBackOffTimeSpan = UnitTestingSolutionCrawlerTimeSpan.ProjectPropagationBackOff; From 6578dc00fdab9ed455090d7372eefee59e74a169 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 27 Sep 2022 12:28:15 -0700 Subject: [PATCH 08/13] Disable unused functionality --- .../UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs | 2 +- .../SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs | 3 ++- ...kCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs | 7 +++++-- ...ngWorkCoordinator.UnitTestingNormalPriorityProcessor.cs | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index c8fe81d6174c4..094fa6c56ef38 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -25,10 +25,10 @@ public Task AnalyzeDocumentAsync(Document document, SyntaxNode bodyOpt, UnitTest public Task AnalyzeProjectAsync(Project project, bool semanticsChanged, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => _implementation.AnalyzeProjectAsync(project, semanticsChanged, reasons, cancellationToken); +#if false // Not used in unit testing crawling public Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => Task.CompletedTask; -#if false // Not used in unit testing crawling public Task DocumentCloseAsync(Document document, CancellationToken cancellationToken) => Task.CompletedTask; diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs index 7ddb11b153157..42822dd6d8478 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs @@ -23,9 +23,10 @@ internal interface IUnitTestingIncrementalAnalyzer /// Resets all the document state cached by the analyzer. /// Task DocumentResetAsync(Document document, CancellationToken cancellationToken); -#endif Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); +#endif + Task AnalyzeDocumentAsync(Document document, SyntaxNode bodyOpt, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); Task AnalyzeProjectAsync(Project project, bool semanticsChanged, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index f3a73dfe77953..c3077b063bb10 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -210,11 +210,14 @@ private async Task ProcessDocumentAnalyzersAsync( // process all analyzers for each categories in this order - syntax, body, document var reasons = workItem.InvocationReasons; + +#if false // Not used in unit testing crawling if (workItem.MustRefresh || reasons.Contains(UnitTestingPredefinedInvocationReasons.SyntaxChanged)) { await RunAnalyzersAsync(analyzers, textDocument, workItem, (analyzer, document, cancellationToken) => AnalyzeSyntaxAsync(analyzer, document, reasons, cancellationToken), cancellationToken).ConfigureAwait(false); } +#endif if (textDocument is not Document document) { @@ -235,6 +238,7 @@ await RunAnalyzersAsync(analyzers, document, workItem, (analyzer, document, canc return; +#if false // Not used in unit testing crawling static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) { if (textDocument is Document document) @@ -243,11 +247,10 @@ static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, T } else { -#if false // Not used in unit testing crawling await analyzer.AnalyzeNonSourceDocumentAsync(textDocument, reasons, cancellationToken).ConfigureAwait(false); -#endif } } +#endif bool ProcessActiveDocumentSwitched(ImmutableArray analyzers, UnitTestingWorkItem workItem, TextDocument document, CancellationToken cancellationToken) { diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index 56366ca4ce4cf..0fb3e87b87678 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -477,10 +477,12 @@ private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, T // No request to re-run syntax change analysis. run it here var reasons = workItem.InvocationReasons; +#if false // Not used in unit testing crawling if (!reasons.Contains(UnitTestingPredefinedInvocationReasons.SyntaxChanged)) { await Processor.RunAnalyzersAsync(reanalyzers, document, workItem, (a, d, c) => AnalyzeSyntaxAsync(a, d, reasons, c), cancellationToken).ConfigureAwait(false); } +#endif // No request to re-run semantic change analysis. run it here // Note: Semantic analysis is not supported for non-source documents. @@ -511,6 +513,7 @@ static async Task DocumentResetAsync(IUnitTestingIncrementalAnalyzer analyzer, T } #endif +#if false // Not used in unit testing crawling static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) { if (textDocument is Document document) @@ -519,11 +522,10 @@ static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, T } else { -#if false // Not used in unit testing crawling await analyzer.AnalyzeNonSourceDocumentAsync(textDocument, reasons, cancellationToken).ConfigureAwait(false); -#endif } } +#endif } private Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken) From 939e2493227c1ce16c694147a16b8403dc8d14a4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 27 Sep 2022 16:27:35 -0700 Subject: [PATCH 09/13] Disable unused functionality --- .../ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs index 2d998df1a3f10..4c2e88a2fa20c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs @@ -29,12 +29,12 @@ public ExportUnitTestingIncrementalAnalyzerProviderAttribute(string name, string #endif } +#if false // Not used in unit testing crawling public ExportUnitTestingIncrementalAnalyzerProviderAttribute(bool highPriorityForActiveFile, string name, string[] workspaceKinds) : this(name, workspaceKinds) { -#if false // Not used in unit testing crawling this.HighPriorityForActiveFile = highPriorityForActiveFile; -#endif } +#endif } } From 1542b2f027063ab9b31a55b0b101d1b3e1d21b39 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 27 Sep 2022 16:35:01 -0700 Subject: [PATCH 10/13] Make synchronous --- ...gWorkCoordinator.UnitTestingNormalPriorityProcessor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index 0fb3e87b87678..8da8571cb1382 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -145,7 +145,7 @@ protected override async Task ExecuteAsync() await WaitForHigherPriorityOperationsAsync().ConfigureAwait(false); // okay, there must be at least one item in the map - await ResetStatesAsync().ConfigureAwait(false); + ResetStates(); if (await TryProcessOneHigherPriorityDocumentAsync().ConfigureAwait(false)) { @@ -539,13 +539,13 @@ private static async Task RemoveDocumentAsync(ImmutableArray Date: Tue, 27 Sep 2022 16:38:15 -0700 Subject: [PATCH 11/13] Disable unused functionality --- .../UnitTestingIncrementalAnalyzerBase.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerBase.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerBase.cs index ff0f787d0181e..84fba6c2a5f7b 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerBase.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerBase.cs @@ -4,7 +4,6 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler { @@ -14,6 +13,8 @@ protected UnitTestingIncrementalAnalyzerBase() { } +#if false // Not used in unit testing crawling + public virtual Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken) => Task.CompletedTask; @@ -32,6 +33,8 @@ public Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken public virtual Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => Task.CompletedTask; +#endif + public virtual Task AnalyzeDocumentAsync(Document document, SyntaxNode bodyOpt, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) => Task.CompletedTask; @@ -41,6 +44,8 @@ public virtual Task AnalyzeProjectAsync(Project project, bool semanticsChanged, public virtual Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken) => Task.CompletedTask; +#if false // Not used in unit testing crawling + public virtual Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellation) => Task.CompletedTask; @@ -68,5 +73,7 @@ public void LogAnalyzerCountSummary() public virtual void Shutdown() { } + +#endif } } From 89840f101dcdd021466494c35bc126e0f3d1241d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 28 Sep 2022 08:27:46 -0700 Subject: [PATCH 12/13] proper pattern --- ...oordinator.UnitTestingIncrementalAnalyzerProcessor.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index c3077b063bb10..f1ac3642fd1c7 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -461,16 +461,17 @@ public ImmutableArray GetOrderedAnalyzers(strin { if (!_analyzerMap.TryGetValue((workspaceKind, services), out var analyzers)) { - analyzers = _analyzerProviders - .Select(p => p.Value.CreateIncrementalAnalyzer()) - .WhereNotNull() - .ToImmutableArray(); #if false // Not used in unit testing crawling // Sort list so DiagnosticIncrementalAnalyzers (if any) come first. analyzers = _analyzerProviders.Select(p => (analyzer: p.Value.CreateIncrementalAnalyzer(), highPriorityForActiveFile: p.Metadata.HighPriorityForActiveFile)) .Where(t => t.analyzer != null) .OrderBy(t => t.analyzer!.Priority) .ToImmutableArray()!; +#else + analyzers = _analyzerProviders + .Select(p => p.Value.CreateIncrementalAnalyzer()) + .WhereNotNull() + .ToImmutableArray(); #endif _analyzerMap[(workspaceKind, services)] = analyzers; From 6dc2ec56fe0189fc368e74ba1c1455eb5dd4fda9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 28 Sep 2022 10:28:35 -0700 Subject: [PATCH 13/13] remove nested ifdefs --- .../API/NewUnitTestingIncrementalAnalyzer.cs | 11 +++-------- ...orkCoordinator.UnitTestingHighPriorityProcessor.cs | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index 094fa6c56ef38..37e22ccb031d3 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -76,18 +76,13 @@ public void LogAnalyzerCountSummary() /// public int Priority => 1; -#if false - - // Unit testing incremental analyzer only supports full solution analysis scope. - // In future, we should add a separate option to allow users to configure background analysis scope for unit testing. - public static BackgroundAnalysisScope GetBackgroundAnalysisScope(OptionSet _) => BackgroundAnalysisScope.FullSolution; - -#endif + // Unit testing incremental analyzer only supports full solution analysis scope. + // In future, we should add a separate option to allow users to configure background analysis scope for unit testing. + public static BackgroundAnalysisScope GetBackgroundAnalysisScope(OptionSet _) => BackgroundAnalysisScope.FullSolution; public void Shutdown() { } - #endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs index 2ec22c7b074de..06fe38ee8aa55 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs @@ -96,13 +96,11 @@ public void Enqueue(UnitTestingWorkItem item) return; } -#if false // Not used in unit testing crawling if (!_processor._documentTracker.SupportsDocumentTracking && _processor._registration.WorkspaceKind is WorkspaceKind.RemoteWorkspace) { Debug.Fail($"Unexpected use of '{nameof(ExportUnitTestingIncrementalAnalyzerProviderAttribute.HighPriorityForActiveFile)}' in workspace kind '{_processor._registration.WorkspaceKind}' that cannot support active file tracking."); } -#endif // check whether given item is for active document, otherwise, nothing to do here if (_processor._documentTracker.TryGetActiveDocument() != item.DocumentId)