From 46a6a2e39213c969c525ad107b6b7ff7c3cafe4b Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 20 Feb 2015 17:17:38 -0800 Subject: [PATCH] Mitigate memory leak and disable affected tests All the disabled tests are associated with issue #759 which tracks re-enabling these. --- .../Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs | 3 ++- src/Compilers/Core/AnalyzerDriver/AnalyzerDriverHelper.cs | 6 ++++-- .../Diagnostics/DiagnosticAnalyzerTests.AllInOne.vb | 3 ++- .../FxCop/Test/HardeningAnalyzer/HardeningAnalyzerTests.cs | 3 ++- .../DiagnosticAnalyzerDriverTests.cs | 3 ++- .../Test2/Diagnostics/DiagnosticServiceTests.vb | 3 ++- .../DiagnosticAnalyzerDriverTests.vb | 3 ++- .../AbstractHostDiagnosticUpdateSource_Registration.cs | 6 ++++-- 8 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs index 319ac126d39fe..bc3b2261fdb95 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs @@ -81,7 +81,8 @@ public class C #endregion - [Fact] + [Fact(Skip = "GitHub Issue 759")] + [WorkItem(759)] public void AnalyzerDriverIsSafeAgainstAnalyzerExceptions() { var compilation = CreateCompilationWithMscorlib45(TestResource.AllInOneCSharpCode, parseOptions: TestOptions.Regular); diff --git a/src/Compilers/Core/AnalyzerDriver/AnalyzerDriverHelper.cs b/src/Compilers/Core/AnalyzerDriver/AnalyzerDriverHelper.cs index 97ee1199eaac3..ef16c1a91c41d 100644 --- a/src/Compilers/Core/AnalyzerDriver/AnalyzerDriverHelper.cs +++ b/src/Compilers/Core/AnalyzerDriver/AnalyzerDriverHelper.cs @@ -508,7 +508,8 @@ internal static EventHandler RegisterAnalyzerEx } }; - AnalyzerExceptionDiagnostic += handler; + // TODO: re-enable once bug 759 is fixed + // AnalyzerExceptionDiagnostic += handler; return handler; } @@ -529,7 +530,8 @@ internal static EventHandler RegisterAnalyzerEx } }; - AnalyzerExceptionDiagnostic += handler; + // TODO: re-enable once bug 759 is fixed + // AnalyzerExceptionDiagnostic += handler; return handler; } diff --git a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.vb b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.vb index 5c3b5c56a1b14..c1697604f980e 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.vb @@ -38,7 +38,8 @@ End Enum CreateCompilationWithMscorlib(source).VerifyAnalyzerDiagnostics({New BasicTrackingDiagnosticAnalyzer()}) End Sub - + + Public Sub AnalyzerDriverIsSafeAgainstAnalyzerExceptions() Dim compilation = CreateCompilationWithMscorlib({TestResource.AllInOneVisualBasicCode}) ThrowingDiagnosticAnalyzer(Of SyntaxKind).VerifyAnalyzerEngineIsSafeAgainstExceptions( diff --git a/src/Diagnostics/FxCop/Test/HardeningAnalyzer/HardeningAnalyzerTests.cs b/src/Diagnostics/FxCop/Test/HardeningAnalyzer/HardeningAnalyzerTests.cs index 085bbd245a6a9..46213e4e17398 100644 --- a/src/Diagnostics/FxCop/Test/HardeningAnalyzer/HardeningAnalyzerTests.cs +++ b/src/Diagnostics/FxCop/Test/HardeningAnalyzer/HardeningAnalyzerTests.cs @@ -25,7 +25,8 @@ protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() return new ExceptionThrowingSymbolAnalyzer_ThrowSymbolKindsOfInterest(); } - [Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)] + [Fact(Skip = "GitHub Issue 759"), Trait(Traits.Feature, Traits.Features.Diagnostics)] + [WorkItem(759)] public void TestTypeParameterNamesCSharp() { var source = @" diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs index fe0a5005a400a..8143c20c4c686 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs @@ -85,7 +85,8 @@ class C } } - [Fact] + [Fact(Skip = "GitHub Issue 759")] + [WorkItem(759)] public void DiagnosticAnalyzerDriverIsSafeAgainstAnalyzerExceptions() { var source = TestResource.AllInOneCSharpCode; diff --git a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb index c0f1b704beb45..130d5693385bc 100644 --- a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb +++ b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb @@ -398,7 +398,8 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests End Using End Sub - + + Public Sub TestDiagnosticAnalyzerExceptionHandledGracefully2() Dim test = diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.vb b/src/EditorFeatures/VisualBasicTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.vb index 783172a92c8d6..1b56c2b8696b3 100644 --- a/src/EditorFeatures/VisualBasicTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.vb @@ -58,7 +58,8 @@ End Class End Using End Sub - + + Public Sub DiagnosticAnalyzerDriverIsSafeAgainstAnalyzerExceptions() Dim source = TestResource.AllInOneVisualBasicCode Using Workspace = VisualBasicWorkspaceFactory.CreateWorkspaceFromFile(source) diff --git a/src/Features/Core/Diagnostics/AbstractHostDiagnosticUpdateSource_Registration.cs b/src/Features/Core/Diagnostics/AbstractHostDiagnosticUpdateSource_Registration.cs index 8499ee7ef9125..b959d7cb215cc 100644 --- a/src/Features/Core/Diagnostics/AbstractHostDiagnosticUpdateSource_Registration.cs +++ b/src/Features/Core/Diagnostics/AbstractHostDiagnosticUpdateSource_Registration.cs @@ -12,13 +12,15 @@ internal abstract partial class AbstractHostDiagnosticUpdateSource protected AbstractHostDiagnosticUpdateSource() { // Register for exception diagnostics from workspace's analyzer manager. - AnalyzerExceptionDiagnostic += OnAnalyzerExceptionDiagnostic; + // TODO: re-enable once bug 759 is fixed + // AnalyzerExceptionDiagnostic += OnAnalyzerExceptionDiagnostic; } ~AbstractHostDiagnosticUpdateSource() { // Unregister for exception diagnostics from workspace's analyzer manager. - AnalyzerExceptionDiagnostic -= OnAnalyzerExceptionDiagnostic; + // TODO: re-enable once bug 759 is fixed + // AnalyzerExceptionDiagnostic -= OnAnalyzerExceptionDiagnostic; } internal static EventHandler RegisterAnalyzerExceptionDiagnosticHandler(ImmutableArray analyzers, Workspace workspace)