diff --git a/eng/Versions.props b/eng/Versions.props index 6c648e85f4e34..c81732bcd904b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -208,6 +208,7 @@ 4.3.0 4.3.0 4.5.1 + 4.7.0 4.5.4 4.7.1 4.7.1 diff --git a/src/Analyzers/CSharp/Tests/AddBraces/AddBracesTests.cs b/src/Analyzers/CSharp/Tests/AddBraces/AddBracesTests.cs index 56cd09f4be7c8..3eaa6145aa87c 100644 --- a/src/Analyzers/CSharp/Tests/AddBraces/AddBracesTests.cs +++ b/src/Analyzers/CSharp/Tests/AddBraces/AddBracesTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddBraces { public partial class AddBracesTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddBracesTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpAddBracesDiagnosticAnalyzer(), new CSharpAddBracesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredExpressionParenthesesTests.cs b/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredExpressionParenthesesTests.cs index 6dabb00b9e40c..8e90f9207896f 100644 --- a/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredExpressionParenthesesTests.cs +++ b/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredExpressionParenthesesTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddRequiredParentheses { public partial class AddRequiredExpressionParenthesesTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddRequiredExpressionParenthesesTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer(), new AddRequiredParenthesesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredPatternParenthesesTests.cs b/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredPatternParenthesesTests.cs index c8d0a7ee8de1b..dc809720b1f71 100644 --- a/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredPatternParenthesesTests.cs +++ b/src/Analyzers/CSharp/Tests/AddRequiredParentheses/AddRequiredPatternParenthesesTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddRequiredParentheses { public partial class AddRequiredPatternParenthesesTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddRequiredPatternParenthesesTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer(), new AddRequiredParenthesesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/ConvertAnonymousTypeToTuple/ConvertAnonymousTypeToTupleTests.cs b/src/Analyzers/CSharp/Tests/ConvertAnonymousTypeToTuple/ConvertAnonymousTypeToTupleTests.cs index 3fab10f329aaa..3f01ac979498a 100644 --- a/src/Analyzers/CSharp/Tests/ConvertAnonymousTypeToTuple/ConvertAnonymousTypeToTupleTests.cs +++ b/src/Analyzers/CSharp/Tests/ConvertAnonymousTypeToTuple/ConvertAnonymousTypeToTupleTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertAnonymousTypeToTuple { public partial class ConvertAnonymousTypeToTupleTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ConvertAnonymousTypeToTupleTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer(), new CSharpConvertAnonymousTypeToTupleCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/ConvertTypeOfToNameOf/ConvertTypeOfToNameOfTests.cs b/src/Analyzers/CSharp/Tests/ConvertTypeOfToNameOf/ConvertTypeOfToNameOfTests.cs index 2efe0bd6cdb24..7c637086787f1 100644 --- a/src/Analyzers/CSharp/Tests/ConvertTypeOfToNameOf/ConvertTypeOfToNameOfTests.cs +++ b/src/Analyzers/CSharp/Tests/ConvertTypeOfToNameOf/ConvertTypeOfToNameOfTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertTypeOfToNameOf { public partial class ConvertTypeOfToNameOfTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ConvertTypeOfToNameOfTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpConvertTypeOfToNameOfDiagnosticAnalyzer(), new CSharpConvertTypeOfToNameOfCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/InlineDeclaration/CSharpInlineDeclarationTests.cs b/src/Analyzers/CSharp/Tests/InlineDeclaration/CSharpInlineDeclarationTests.cs index c030113ccc88b..a85bccac16e47 100644 --- a/src/Analyzers/CSharp/Tests/InlineDeclaration/CSharpInlineDeclarationTests.cs +++ b/src/Analyzers/CSharp/Tests/InlineDeclaration/CSharpInlineDeclarationTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.InlineDeclaration { public partial class CSharpInlineDeclarationTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpInlineDeclarationTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpInlineDeclarationDiagnosticAnalyzer(), new CSharpInlineDeclarationCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs b/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs index 537e20321c2a8..545dececa5e84 100644 --- a/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs +++ b/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.InvokeDelegateWithConditionalAccess { public partial class InvokeDelegateWithConditionalAccessTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public InvokeDelegateWithConditionalAccessTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new InvokeDelegateWithConditionalAccessAnalyzer(), new InvokeDelegateWithConditionalAccessCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs b/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs index 214b33631ba97..dee0fbe2bec52 100644 --- a/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs +++ b/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeFieldReadonly { public class MakeFieldReadonlyTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public MakeFieldReadonlyTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new MakeFieldReadonlyDiagnosticAnalyzer(), new CSharpMakeFieldReadonlyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/MakeLocalFunctionStatic/MakeLocalFunctionStaticTests.cs b/src/Analyzers/CSharp/Tests/MakeLocalFunctionStatic/MakeLocalFunctionStaticTests.cs index 1491aba78d87e..d00a9e32c17e8 100644 --- a/src/Analyzers/CSharp/Tests/MakeLocalFunctionStatic/MakeLocalFunctionStaticTests.cs +++ b/src/Analyzers/CSharp/Tests/MakeLocalFunctionStatic/MakeLocalFunctionStaticTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeLocalFunctionStatic { public partial class MakeLocalFunctionStaticTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public MakeLocalFunctionStaticTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new MakeLocalFunctionStaticDiagnosticAnalyzer(), GetMakeLocalFunctionStaticCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProviderTests.cs b/src/Analyzers/CSharp/Tests/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProviderTests.cs index f09fb396813bd..56b8d9eb7261e 100644 --- a/src/Analyzers/CSharp/Tests/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProviderTests.cs +++ b/src/Analyzers/CSharp/Tests/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProviderTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MisplacedUsingDirectives { public class MisplacedUsingDirectivesInCompilationUnitCodeFixProviderTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public MisplacedUsingDirectivesInCompilationUnitCodeFixProviderTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new MisplacedUsingDirectivesDiagnosticAnalyzer(), new MisplacedUsingDirectivesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs b/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs index 36b52c1acef66..8ac0180751a54 100644 --- a/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs +++ b/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs @@ -14,11 +14,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.NamingStyles { public class NamingStylesTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public NamingStylesTests(ITestOutputHelper logger) + : base(logger) + { + } + private static readonly NamingStylesTestOptionSets s_options = new NamingStylesTestOptionSets(LanguageNames.CSharp); internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) diff --git a/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersCompilerErrorTests.cs b/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersCompilerErrorTests.cs index e29d041acd565..1ce1c7be4618f 100644 --- a/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersCompilerErrorTests.cs +++ b/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersCompilerErrorTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.OrderModifiers { public sealed class OrderModifiersCompilerErrorTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public OrderModifiersCompilerErrorTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpOrderModifiersCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersTests.cs b/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersTests.cs index 1943499a3d7e0..80cf13b5c6da9 100644 --- a/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersTests.cs +++ b/src/Analyzers/CSharp/Tests/OrderModifiers/OrderModifiersTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.OrderModifiers { public class OrderModifiersTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public OrderModifiersTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpOrderModifiersDiagnosticAnalyzer(), new CSharpOrderModifiersCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests.cs b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests.cs index fb72df9c95565..80d92d0394dbf 100644 --- a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests.cs +++ b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests.cs @@ -11,12 +11,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.PopulateSwitch { [Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)] public partial class PopulateSwitchExpressionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public PopulateSwitchExpressionTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpPopulateSwitchExpressionDiagnosticAnalyzer(), new CSharpPopulateSwitchExpressionCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests_FixAllTests.cs index a6d36937a3981..ea2d440a87238 100644 --- a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchExpressionTests_FixAllTests.cs @@ -7,10 +7,11 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.PopulateSwitch { - public partial class PopulateSwitchExpressionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest + public partial class PopulateSwitchExpressionTests { [Fact] [Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)] diff --git a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests.cs b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests.cs index bf8ebc09bdcf0..22bb85a58dce7 100644 --- a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests.cs +++ b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.PopulateSwitch { public partial class PopulateSwitchStatementTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public PopulateSwitchStatementTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpPopulateSwitchStatementDiagnosticAnalyzer(), new CSharpPopulateSwitchStatementCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs index 31b890b0859f4..1d30a002263a0 100644 --- a/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.cs @@ -5,10 +5,11 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.PopulateSwitch { - public partial class PopulateSwitchStatementTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest + public partial class PopulateSwitchStatementTests { [Fact] [Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)] diff --git a/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests.cs b/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests.cs index 3bbed520303b8..91b7ccacecdb5 100644 --- a/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests.cs +++ b/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QualifyMemberAccess { public partial class QualifyMemberAccessTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public QualifyMemberAccessTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpQualifyMemberAccessDiagnosticAnalyzer(), new CSharpQualifyMemberAccessCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests_FixAllTests.cs index 28614834b8391..3e372e2b56416 100644 --- a/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/QualifyMemberAccess/QualifyMemberAccessTests_FixAllTests.cs @@ -7,10 +7,11 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QualifyMemberAccess { - public partial class QualifyMemberAccessTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest + public partial class QualifyMemberAccessTests { [Fact] [Trait(Traits.Feature, Traits.Features.CodeActionsQualifyMemberAccess)] diff --git a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_FixAllTests.cs index 2b614fc7d0b3d..4e48f884c5356 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_FixAllTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessaryCast { public class RemoveUnnecessaryCastTests_FixAllTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnnecessaryCastTests_FixAllTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnnecessaryCastDiagnosticAnalyzer(), new CSharpRemoveUnnecessaryCastCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryImports/RemoveUnnecessaryImportsTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryImports/RemoveUnnecessaryImportsTests_FixAllTests.cs index c5173c815c8fb..bfb0d65b2613b 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryImports/RemoveUnnecessaryImportsTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryImports/RemoveUnnecessaryImportsTests_FixAllTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessaryImports { public class RemoveUnnecessaryImportsTests_FixAllTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnnecessaryImportsTests_FixAllTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer(), new CSharpRemoveUnnecessaryImportsCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryExpressionParenthesesTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryExpressionParenthesesTests.cs index 0a914440f97c1..2bca6a62a3ef6 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryExpressionParenthesesTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryExpressionParenthesesTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessaryParentheses { public partial class RemoveUnnecessaryExpressionParenthesesTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnnecessaryExpressionParenthesesTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer(), new CSharpRemoveUnnecessaryParenthesesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryPatternParenthesesTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryPatternParenthesesTests.cs index 7e87a59ad5522..ba7b7ce976fc3 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryPatternParenthesesTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryPatternParenthesesTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessaryParentheses { public partial class RemoveUnnecessaryPatternParenthesesTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnnecessaryPatternParenthesesTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer(), new CSharpRemoveUnnecessaryParenthesesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnreachableCode/RemoveUnreachableCodeTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnreachableCode/RemoveUnreachableCodeTests.cs index 4279fced2354b..409f8c878ffbc 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnreachableCode/RemoveUnreachableCodeTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnreachableCode/RemoveUnreachableCodeTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnreachableCode { public class RemoveUnreachableCodeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnreachableCodeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnreachableCodeDiagnosticAnalyzer(), new CSharpRemoveUnreachableCodeCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedParametersTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedParametersTests.cs index d32a7a3718534..39a6edb22c7cb 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedParametersTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedParametersTests.cs @@ -15,12 +15,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; using static Roslyn.Test.Utilities.TestHelpers; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnusedParametersAndValues { public class RemoveUnusedParametersTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnusedParametersTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer(), new CSharpRemoveUnusedValuesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueAssignmentTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueAssignmentTests.cs index ec3fa85511b27..177404395477a 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueAssignmentTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueAssignmentTests.cs @@ -13,6 +13,7 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; +using Xunit.Abstractions; using static Roslyn.Test.Utilities.TestHelpers; using VerifyCS = Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions.CSharpCodeFixVerifier< Microsoft.CodeAnalysis.CSharp.RemoveUnusedParametersAndValues.CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer, @@ -22,6 +23,11 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnusedParametersA { public class RemoveUnusedValueAssignmentTests : RemoveUnusedValuesTestsBase { + public RemoveUnusedValueAssignmentTests(ITestOutputHelper logger) + : base(logger) + { + } + private protected override OptionsCollection PreferNone => Option(CSharpCodeStyleOptions.UnusedValueAssignment, new CodeStyleOption2(UnusedValuePreference.DiscardVariable, NotificationOption2.None)); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueExpressionStatementTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueExpressionStatementTests.cs index 326586d125793..c65bcdc8c78a5 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueExpressionStatementTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValueExpressionStatementTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnusedParametersAndValues { public partial class RemoveUnusedValueExpressionStatementTests : RemoveUnusedValuesTestsBase { + public RemoveUnusedValueExpressionStatementTests(ITestOutputHelper logger) + : base(logger) + { + } + private protected override OptionsCollection PreferNone => Option(CSharpCodeStyleOptions.UnusedValueExpressionStatement, new CodeStyleOption2(UnusedValuePreference.DiscardVariable, NotificationOption2.None)); diff --git a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValuesTestsBase.cs b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValuesTestsBase.cs index a4df7db719950..93b070fa9a52f 100644 --- a/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValuesTestsBase.cs +++ b/src/Analyzers/CSharp/Tests/RemoveUnusedParametersAndValues/RemoveUnusedValuesTestsBase.cs @@ -8,11 +8,17 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnusedParametersAndValues { public abstract class RemoveUnusedValuesTestsBase : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnusedValuesTestsBase(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer(), new CSharpRemoveUnusedValuesCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/SimplifyBooleanExpression/SimplifyConditionalTests.cs b/src/Analyzers/CSharp/Tests/SimplifyBooleanExpression/SimplifyConditionalTests.cs index d382dc7a480b7..b6c51d2af7dd6 100644 --- a/src/Analyzers/CSharp/Tests/SimplifyBooleanExpression/SimplifyConditionalTests.cs +++ b/src/Analyzers/CSharp/Tests/SimplifyBooleanExpression/SimplifyConditionalTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.SimplifyBooleanExpression; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SimplifyBooleanExpression { public partial class SimplifyConditionalTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public SimplifyConditionalTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpSimplifyConditionalDiagnosticAnalyzer(), new SimplifyConditionalCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/SimplifyInterpolation/SimplifyInterpolationTests.cs b/src/Analyzers/CSharp/Tests/SimplifyInterpolation/SimplifyInterpolationTests.cs index 69f1507adaaeb..4ddac22ac97ed 100644 --- a/src/Analyzers/CSharp/Tests/SimplifyInterpolation/SimplifyInterpolationTests.cs +++ b/src/Analyzers/CSharp/Tests/SimplifyInterpolation/SimplifyInterpolationTests.cs @@ -11,12 +11,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SimplifyInterpolation { [Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyInterpolation)] public partial class SimplifyInterpolationTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public SimplifyInterpolationTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpSimplifyInterpolationDiagnosticAnalyzer(), new CSharpSimplifyInterpolationCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseAutoProperty/UseAutoPropertyTests.cs b/src/Analyzers/CSharp/Tests/UseAutoProperty/UseAutoPropertyTests.cs index b00bc32d8925d..7a8cac1d4cf9e 100644 --- a/src/Analyzers/CSharp/Tests/UseAutoProperty/UseAutoPropertyTests.cs +++ b/src/Analyzers/CSharp/Tests/UseAutoProperty/UseAutoPropertyTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseAutoProperty { public class UseAutoPropertyTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseAutoPropertyTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseAutoPropertyAnalyzer(), GetCSharpUseAutoPropertyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTests.cs b/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTests.cs index 7cfb2dab4634d..facbb64d8c2c8 100644 --- a/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.UseCoalesceExpression; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseCoalesceExpression { public class UseCoalesceExpressionForNullableTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseCoalesceExpressionForNullableTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseCoalesceExpressionForNullableDiagnosticAnalyzer(), new UseCoalesceExpressionForNullableCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionTests.cs b/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionTests.cs index 0f2c33f04fc6a..f7bc019406bff 100644 --- a/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.UseCoalesceExpression; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseCoalesceExpression { public class UseCoalesceExpressionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseCoalesceExpressionTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseCoalesceExpressionDiagnosticAnalyzer(), new UseCoalesceExpressionCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs index 04971c0708200..9bcd8d2087933 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseCollectionInitializer { public partial class UseCollectionInitializerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseCollectionInitializerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseCollectionInitializerDiagnosticAnalyzer(), new CSharpUseCollectionInitializerCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.cs b/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.cs index d7390c5a991f3..2c9fc7014b87e 100644 --- a/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseCompoundAssignment { public class UseCompoundAssignmentTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseCompoundAssignmentTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseCompoundAssignmentDiagnosticAnalyzer(), new CSharpUseCompoundAssignmentCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs b/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs index 98b117abbe0fa..00e854770fb3a 100644 --- a/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseCompoundAssignment { public class UseCompoundCoalesceAssignmentTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseCompoundCoalesceAssignmentTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer(), new CSharpUseCompoundCoalesceAssignmentCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForAssignmentTests.cs b/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForAssignmentTests.cs index 3d0e3c3522d04..862b1f0e1248e 100644 --- a/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForAssignmentTests.cs +++ b/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForAssignmentTests.cs @@ -14,11 +14,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseConditionalExpression { public partial class UseConditionalExpressionForAssignmentTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseConditionalExpressionForAssignmentTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseConditionalExpressionForAssignmentDiagnosticAnalyzer(), new CSharpUseConditionalExpressionForAssignmentCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForReturnTests.cs b/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForReturnTests.cs index 110506e5d3aca..d1b2b119e84c2 100644 --- a/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForReturnTests.cs +++ b/src/Analyzers/CSharp/Tests/UseConditionalExpression/UseConditionalExpressionForReturnTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseConditionalExpression { public partial class UseConditionalExpressionForReturnTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseConditionalExpressionForReturnTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer(), new CSharpUseConditionalExpressionForReturnCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseDeconstruction/UseDeconstructionTests.cs b/src/Analyzers/CSharp/Tests/UseDeconstruction/UseDeconstructionTests.cs index 25693932a3a84..53083934c64dd 100644 --- a/src/Analyzers/CSharp/Tests/UseDeconstruction/UseDeconstructionTests.cs +++ b/src/Analyzers/CSharp/Tests/UseDeconstruction/UseDeconstructionTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseDeconstruction { public class UseDeconstructionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseDeconstructionTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseDeconstructionDiagnosticAnalyzer(), new CSharpUseDeconstructionCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseDefaultLiteral/UseDefaultLiteralTests.cs b/src/Analyzers/CSharp/Tests/UseDefaultLiteral/UseDefaultLiteralTests.cs index 4fb90c2cbb00e..c8cc8d5d8d85a 100644 --- a/src/Analyzers/CSharp/Tests/UseDefaultLiteral/UseDefaultLiteralTests.cs +++ b/src/Analyzers/CSharp/Tests/UseDefaultLiteral/UseDefaultLiteralTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseDefaultLiteral { public class UseDefaultLiteralTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseDefaultLiteralTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseDefaultLiteralDiagnosticAnalyzer(), new CSharpUseDefaultLiteralCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExplicitTupleName/UseExplicitTupleNameTests.cs b/src/Analyzers/CSharp/Tests/UseExplicitTupleName/UseExplicitTupleNameTests.cs index a94d60486a898..1928ce57bc4c9 100644 --- a/src/Analyzers/CSharp/Tests/UseExplicitTupleName/UseExplicitTupleNameTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExplicitTupleName/UseExplicitTupleNameTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.UseExplicitTupleName; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExplicitTupleName { public class UseExplicitTupleNameTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExplicitTupleNameTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExplicitTupleNameDiagnosticAnalyzer(), new UseExplicitTupleNameCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForAccessorsAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForAccessorsAnalyzerTests.cs index 76ab89f3de07b..a13db5ded1ecd 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForAccessorsAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForAccessorsAnalyzerTests.cs @@ -14,11 +14,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForAccessorsTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForAccessorsTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConstructorsAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConstructorsAnalyzerTests.cs index 35e9ce6d6b921..c506fb2ea3d6d 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConstructorsAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConstructorsAnalyzerTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForConstructorsAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForConstructorsAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConversionOperatorsAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConversionOperatorsAnalyzerTests.cs index 4ce5d7b73da0c..b383e855bc99a 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConversionOperatorsAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForConversionOperatorsAnalyzerTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForConversionOperatorsAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForConversionOperatorsAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForIndexersAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForIndexersAnalyzerTests.cs index b7bfb73eb5636..5f7855a5d0fd5 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForIndexersAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForIndexersAnalyzerTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForIndexersAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForIndexersAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForLocalFunctionsAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForLocalFunctionsAnalyzerTests.cs index 5d835f1f8317f..9c9e2c84a765f 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForLocalFunctionsAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForLocalFunctionsAnalyzerTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForLocalFunctionsAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForLocalFunctionsAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForMethodsAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForMethodsAnalyzerTests.cs index 42c669892f33d..70df880819807 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForMethodsAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForMethodsAnalyzerTests.cs @@ -14,11 +14,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForMethodsAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForMethodsAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForOperatorsAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForOperatorsAnalyzerTests.cs index 341c73a668dfd..1ed44f764f146 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForOperatorsAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForOperatorsAnalyzerTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForOperatorsAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForOperatorsAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForPropertiesAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForPropertiesAnalyzerTests.cs index 867e003d87e55..b69b05a214d2b 100644 --- a/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForPropertiesAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForPropertiesAnalyzerTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForPropertiesAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForPropertiesAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyDiagnosticAnalyzer(), new UseExpressionBodyCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests.cs b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests.cs index a1796e2401412..f11ca1d07e964 100644 --- a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests.cs +++ b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UseExplicitType { public partial class UseExplicitTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExplicitTypeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseExplicitTypeDiagnosticAnalyzer(), new UseExplicitTypeCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests_FixAllTests.cs index b2a1a8f6666ab..68a2ec47b16d6 100644 --- a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseExplicitTypeTests_FixAllTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UseExplicitType { - public partial class UseExplicitTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest + public partial class UseExplicitTypeTests { #region "Fix all occurrences tests" diff --git a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests.cs b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests.cs index 384b77673b5fa..d916f8e114281 100644 --- a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests.cs +++ b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests.cs @@ -14,11 +14,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UseImplicitType { public partial class UseImplicitTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseImplicitTypeTests(ITestOutputHelper logger = null) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseImplicitTypeDiagnosticAnalyzer(), new UseImplicitTypeCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests_FixAllTests.cs index 6db867339450d..33038ee391612 100644 --- a/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/UseImplicitOrExplicitType/UseImplicitTypeTests_FixAllTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UseImplicitType { - public partial class UseImplicitTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest + public partial class UseImplicitTypeTests { #region "Fix all occurrences tests" diff --git a/src/Analyzers/CSharp/Tests/UseInferredMemberName/UseInferredMemberNameTests.cs b/src/Analyzers/CSharp/Tests/UseInferredMemberName/UseInferredMemberNameTests.cs index 7d87203d4c422..79574fc7dd3f6 100644 --- a/src/Analyzers/CSharp/Tests/UseInferredMemberName/UseInferredMemberNameTests.cs +++ b/src/Analyzers/CSharp/Tests/UseInferredMemberName/UseInferredMemberNameTests.cs @@ -11,12 +11,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.InferredMemberName { [Trait(Traits.Feature, Traits.Features.CodeActionsUseInferredMemberName)] public class UseInferredMemberNameTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseInferredMemberNameTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseInferredMemberNameDiagnosticAnalyzer(), new CSharpUseInferredMemberNameCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForCastAndEqualityOperatorTests.cs b/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForCastAndEqualityOperatorTests.cs index 08d002cc5edc7..b6bbd037aa9c9 100644 --- a/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForCastAndEqualityOperatorTests.cs +++ b/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForCastAndEqualityOperatorTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseIsNullCheck { public partial class UseIsNullCheckForCastAndEqualityOperatorTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseIsNullCheckForCastAndEqualityOperatorTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer(), new CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs b/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs index 562a87313af2b..0f1da60980dcc 100644 --- a/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs +++ b/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseIsNullCheck { public partial class UseIsNullCheckForReferenceEqualsTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseIsNullCheckForReferenceEqualsTests(ITestOutputHelper logger) + : base(logger) + { + } + private static readonly ParseOptions CSharp7 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7); private static readonly ParseOptions CSharp9 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp9); diff --git a/src/Analyzers/CSharp/Tests/UseLocalFunction/UseLocalFunctionTests.cs b/src/Analyzers/CSharp/Tests/UseLocalFunction/UseLocalFunctionTests.cs index 15b3c39114e58..3159f44b7ba62 100644 --- a/src/Analyzers/CSharp/Tests/UseLocalFunction/UseLocalFunctionTests.cs +++ b/src/Analyzers/CSharp/Tests/UseLocalFunction/UseLocalFunctionTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseLocalFunction { public partial class UseLocalFunctionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseLocalFunctionTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseLocalFunctionDiagnosticAnalyzer(), GetCSharpUseLocalFunctionCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseNullPropagation/UseNullPropagationTests.cs b/src/Analyzers/CSharp/Tests/UseNullPropagation/UseNullPropagationTests.cs index ce221a9f55343..d81bc3a33bf32 100644 --- a/src/Analyzers/CSharp/Tests/UseNullPropagation/UseNullPropagationTests.cs +++ b/src/Analyzers/CSharp/Tests/UseNullPropagation/UseNullPropagationTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseNullPropagation { public partial class UseNullPropagationTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseNullPropagationTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseNullPropagationDiagnosticAnalyzer(), new CSharpUseNullPropagationCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseObjectInitializer/UseObjectInitializerTests.cs b/src/Analyzers/CSharp/Tests/UseObjectInitializer/UseObjectInitializerTests.cs index b38c3d7992e13..53bb0430d5c1f 100644 --- a/src/Analyzers/CSharp/Tests/UseObjectInitializer/UseObjectInitializerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseObjectInitializer/UseObjectInitializerTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseObjectInitializer { public partial class UseObjectInitializerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseObjectInitializerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseObjectInitializerDiagnosticAnalyzer(), new CSharpUseObjectInitializerCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpAsAndNullCheckTests.cs b/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpAsAndNullCheckTests.cs index b99f976dcd074..4b31560e138a8 100644 --- a/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpAsAndNullCheckTests.cs +++ b/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpAsAndNullCheckTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UsePatternMatching { public partial class CSharpAsAndNullCheckTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpAsAndNullCheckTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpAsAndNullCheckDiagnosticAnalyzer(), new CSharpAsAndNullCheckCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs b/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs index 13da3be0c9060..2e71261f1e9b9 100644 --- a/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs +++ b/src/Analyzers/CSharp/Tests/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs @@ -15,11 +15,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UsePatternMatching { public partial class CSharpIsAndCastCheckDiagnosticAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpIsAndCastCheckDiagnosticAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpIsAndCastCheckDiagnosticAnalyzer(), new CSharpIsAndCastCheckCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseSimpleUsingStatement/UseSimpleUsingStatementTests.cs b/src/Analyzers/CSharp/Tests/UseSimpleUsingStatement/UseSimpleUsingStatementTests.cs index 5314784c97308..d0ad6709e5921 100644 --- a/src/Analyzers/CSharp/Tests/UseSimpleUsingStatement/UseSimpleUsingStatementTests.cs +++ b/src/Analyzers/CSharp/Tests/UseSimpleUsingStatement/UseSimpleUsingStatementTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseSimpleUsingStatement { public partial class UseSimpleUsingStatementTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseSimpleUsingStatementTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseSimpleUsingStatementDiagnosticAnalyzer(), new UseSimpleUsingStatementCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseSystemHashCode/UseSystemHashCodeTests.cs b/src/Analyzers/CSharp/Tests/UseSystemHashCode/UseSystemHashCodeTests.cs index 75532e1539f60..d3f189bbef7ea 100644 --- a/src/Analyzers/CSharp/Tests/UseSystemHashCode/UseSystemHashCodeTests.cs +++ b/src/Analyzers/CSharp/Tests/UseSystemHashCode/UseSystemHashCodeTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.UseSystemHashCode; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseSystemHashCode { public partial class UseSystemHashCodeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseSystemHashCodeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseSystemHashCodeDiagnosticAnalyzer(), new UseSystemHashCodeCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests.cs b/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests.cs index dde7f6181235f..c8ff9a13a39fb 100644 --- a/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests.cs +++ b/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests.cs @@ -14,11 +14,17 @@ using Microsoft.CodeAnalysis.UseThrowExpression; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseThrowExpression { public partial class UseThrowExpressionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseThrowExpressionTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseThrowExpressionDiagnosticAnalyzer(), new UseThrowExpressionCodeFixProvider()); diff --git a/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests_FixAllTests.cs index b7ec7af4cb8d8..5e5fbb70b5ecb 100644 --- a/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/UseThrowExpression/UseThrowExpressionTests_FixAllTests.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseThrowExpression { - public partial class UseThrowExpressionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest + public partial class UseThrowExpressionTests { [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseThrowExpression)] public async Task FixAllInDocument1() diff --git a/src/Analyzers/CSharp/Tests/ValidateFormatString/ValidateFormatStringTests.cs b/src/Analyzers/CSharp/Tests/ValidateFormatString/ValidateFormatStringTests.cs index 489fd238c6032..065b818d137e2 100644 --- a/src/Analyzers/CSharp/Tests/ValidateFormatString/ValidateFormatStringTests.cs +++ b/src/Analyzers/CSharp/Tests/ValidateFormatString/ValidateFormatStringTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.ValidateFormatString; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ValidateFormatString { public class ValidateFormatStringTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ValidateFormatStringTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpValidateFormatStringDiagnosticAnalyzer(), null); diff --git a/src/Compilers/Core/Portable/Serialization/ObjectReader.cs b/src/Compilers/Core/Portable/Serialization/ObjectReader.cs index dad5d93b28d25..bf3810e66c0b0 100644 --- a/src/Compilers/Core/Portable/Serialization/ObjectReader.cs +++ b/src/Compilers/Core/Portable/Serialization/ObjectReader.cs @@ -106,6 +106,42 @@ public static ObjectReader TryGetReader( return new ObjectReader(stream, leaveOpen, cancellationToken); } + /// + /// Creates an from the provided . + /// Unlike , it requires the version + /// of the data in the stream to exactly match the current format version. + /// Should only be used to read data written by the same version of Roslyn. + /// + public static ObjectReader GetReader( + Stream stream, + bool leaveOpen, + CancellationToken cancellationToken) + { + var b = stream.ReadByte(); + if (b == -1) + { + throw new EndOfStreamException(); + } + + if (b != VersionByte1) + { + throw ExceptionUtilities.UnexpectedValue(b); + } + + b = stream.ReadByte(); + if (b == -1) + { + throw new EndOfStreamException(); + } + + if (b != VersionByte2) + { + throw ExceptionUtilities.UnexpectedValue(b); + } + + return new ObjectReader(stream, leaveOpen, cancellationToken); + } + public void Dispose() { _objectReferenceMap.Dispose(); diff --git a/src/EditorFeatures/CSharpTest/AddAnonymousTypeMemberName/AddAnonymousTypeMemberNameTests.cs b/src/EditorFeatures/CSharpTest/AddAnonymousTypeMemberName/AddAnonymousTypeMemberNameTests.cs index f0b968f8b6483..6e93d43fc1a9b 100644 --- a/src/EditorFeatures/CSharpTest/AddAnonymousTypeMemberName/AddAnonymousTypeMemberNameTests.cs +++ b/src/EditorFeatures/CSharpTest/AddAnonymousTypeMemberName/AddAnonymousTypeMemberNameTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddAnonymousTypeMemberName { public class AddAnonymousTypeMemberNameTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddAnonymousTypeMemberNameTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAddAnonymousTypeMemberNameCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs b/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs index f2c7682f5a78a..f21a80254b799 100644 --- a/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs +++ b/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs @@ -15,11 +15,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddParameter { public class AddParameterTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddParameterTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAddParameterCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/AddUsing/AbstractAddUsingTests.cs b/src/EditorFeatures/CSharpTest/AddUsing/AbstractAddUsingTests.cs index 3e81829ca71be..6324819caff4d 100644 --- a/src/EditorFeatures/CSharpTest/AddUsing/AbstractAddUsingTests.cs +++ b/src/EditorFeatures/CSharpTest/AddUsing/AbstractAddUsingTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Remote.Testing; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing { public abstract class AbstractAddUsingTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AbstractAddUsingTests(ITestOutputHelper logger = null) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAddImportCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTests.cs b/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTests.cs index d679868eb66b4..9ea14630ea63f 100644 --- a/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTests.cs +++ b/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTests.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; using static Roslyn.Test.Utilities.TestMetadata; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing @@ -22,6 +23,11 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing [Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)] public partial class AddUsingTests : AbstractAddUsingTests { + public AddUsingTests(ITestOutputHelper logger) + : base(logger) + { + } + [Theory] [CombinatorialData] public async Task TestTypeFromMultipleNamespaces1(TestHost testHost) diff --git a/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs b/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs index 9e79b62adf118..17f93a0c89fc5 100644 --- a/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs +++ b/src/EditorFeatures/CSharpTest/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs @@ -11,12 +11,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing { [Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)] public partial class AddUsingTestsWithAddImportDiagnosticProvider : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddUsingTestsWithAddImportDiagnosticProvider(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUnboundIdentifiersDiagnosticAnalyzer(), new CSharpAddImportCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/AliasAmbiguousType/AliasAmbiguousTypeTests.cs b/src/EditorFeatures/CSharpTest/AliasAmbiguousType/AliasAmbiguousTypeTests.cs index 22a038863dd72..753b8f89a4235 100644 --- a/src/EditorFeatures/CSharpTest/AliasAmbiguousType/AliasAmbiguousTypeTests.cs +++ b/src/EditorFeatures/CSharpTest/AliasAmbiguousType/AliasAmbiguousTypeTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AliasAmbiguousType { public class AliasAmbiguousTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AliasAmbiguousTypeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAliasAmbiguousTypeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest.cs b/src/EditorFeatures/CSharpTest/Diagnostics/AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest.cs index f0c3cca0c255d..4eedf0d8333a6 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest.cs @@ -7,11 +7,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Test.Utilities; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics { public abstract partial class AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest : AbstractDiagnosticProviderBasedUserDiagnosticTest { + public AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest(ITestOutputHelper logger) + : base(logger) + { + } + protected override ParseOptions GetScriptOptions() => Options.Script; protected internal override string GetLanguage() => LanguageNames.CSharp; diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.cs index 9b949f979572f..de9b09fd60c5d 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AddExplicitCast { public partial class AddExplicitCastTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddExplicitCastTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAddExplicitCastCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs index d06829e89d1b6..e936e42140ee8 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs @@ -8,11 +8,17 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.ConditionalExpressionInStringInterpolation { public class CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/FixAllProvider/BatchFixerTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/FixAllProvider/BatchFixerTests.cs index 5277406421946..2338a55dc0246 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/FixAllProvider/BatchFixerTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/FixAllProvider/BatchFixerTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.SimplifyTypeNames { public partial class BatchFixerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public BatchFixerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new QualifyWithThisAnalyzer(), new QualifyWithThisFixer()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/FixReturnType/FixReturnTypeTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/FixReturnType/FixReturnTypeTests.cs index ffa36f0228f7b..bd720a9a4e058 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/FixReturnType/FixReturnTypeTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/FixReturnType/FixReturnTypeTests.cs @@ -9,12 +9,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.FixReturnType { [Trait(Traits.Feature, Traits.Features.CodeActionsFixReturnType)] public partial class FixReturnTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public FixReturnTypeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpFixReturnTypeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs index 2519321576ad5..12b386fb0a50f 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateEnumMember { public class GenerateEnumMemberTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateEnumMemberTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new GenerateEnumMemberCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateConversionTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateConversionTests.cs index 9f0f37f955c62..d6e5c6df6dbb8 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateConversionTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateConversionTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateMethod { public class GenerateConversionTest : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateConversionTest(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new GenerateConversionCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateDeconstructMethodTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateDeconstructMethodTests.cs index 01e4f9d12c31b..bb008ed7af4dd 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateDeconstructMethodTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateDeconstructMethodTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateDeconstructMethod { public class GenerateDeconstructMethodTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateDeconstructMethodTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new GenerateDeconstructMethodCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs index 2a6349654b5f4..d6a6ff26fabe4 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs @@ -13,11 +13,17 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateMethod { public class GenerateMethodTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateMethodTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new GenerateMethodCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs index f5a84a8c95244..f2d852267494f 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs @@ -15,11 +15,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateTypeTests { public partial class GenerateTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateTypeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new GenerateTypeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs index 7d182a4868b29..131cd5fc2f830 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateTypeTests { public partial class GenerateTypeWithUnboundAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateTypeWithUnboundAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUnboundIdentifiersDiagnosticAnalyzer(), new GenerateTypeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/HideBase/HideBaseTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/HideBase/HideBaseTests.cs index f12f54725c676..1c41a8453db66 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/HideBase/HideBaseTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/HideBase/HideBaseTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.HideBase { public class HideBaseTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public HideBaseTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new HideBaseCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/AddYieldTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/AddYieldTests.cs index 72bccd244e0ab..74b9fbd4bc039 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/AddYieldTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/AddYieldTests.cs @@ -8,11 +8,17 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.Iterator { public class AddYieldTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddYieldTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAddYieldCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/ChangeToIEnumerableTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/ChangeToIEnumerableTests.cs index def4c180b457b..eb7ad976799c6 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/ChangeToIEnumerableTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/ChangeToIEnumerableTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.Iterator { public class ChangeToIEnumerableTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ChangeToIEnumerableTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpChangeToIEnumerableCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/MakeMethodAsynchronous/MakeMethodAsynchronousTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/MakeMethodAsynchronous/MakeMethodAsynchronousTests.cs index a8fcb2ba42b66..b0d8b02bf8f6e 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/MakeMethodAsynchronous/MakeMethodAsynchronousTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/MakeMethodAsynchronous/MakeMethodAsynchronousTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.MakeMethodAsynchronous { public partial class MakeMethodAsynchronousTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public MakeMethodAsynchronousTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpMakeMethodAsynchronousCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs index e1d5986828f75..08323e684c364 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs @@ -9,12 +9,18 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.MakeStatementAsynchronous { [Trait(Traits.Feature, Traits.Features.CodeActionsMakeStatementAsynchronous)] public class CSharpMakeStatementAsynchronousCodeFixTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpMakeStatementAsynchronousCodeFixTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpMakeStatementAsynchronousCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/MockDiagnosticAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/MockDiagnosticAnalyzerTests.cs index 36f5230bcadf1..4eebb9e6bc5f8 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/MockDiagnosticAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/MockDiagnosticAnalyzerTests.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.MockDiagnosticAnalyzer { @@ -39,6 +40,11 @@ public void AnalyzeCompilation(CompilationAnalysisContext context) } } + public MockDiagnosticAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new MockDiagnosticAnalyzer(), null); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/Nullable/CSharpDeclareAsNullableCodeFixTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/Nullable/CSharpDeclareAsNullableCodeFixTests.cs index cae77791dafe1..2d7eb81bc6513 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/Nullable/CSharpDeclareAsNullableCodeFixTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/Nullable/CSharpDeclareAsNullableCodeFixTests.cs @@ -10,12 +10,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.DeclareAsNullable { [Trait(Traits.Feature, Traits.Features.CodeActionsDeclareAsNullable)] public class CSharpDeclareAsNullableCodeFixTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpDeclareAsNullableCodeFixTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpDeclareAsNullableCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/PreferFrameworkType/PreferFrameworkTypeTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/PreferFrameworkType/PreferFrameworkTypeTests.cs index 2a38c09f55842..87868cb0f206a 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/PreferFrameworkType/PreferFrameworkTypeTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/PreferFrameworkType/PreferFrameworkTypeTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.PreferFrameworkType; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.PreferFrameworkType { public partial class PreferFrameworkTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public PreferFrameworkTypeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpPreferFrameworkTypeDiagnosticAnalyzer(), new PreferFrameworkTypeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/RemoveInKeyword/RemoveInKeywordCodeFixProviderTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/RemoveInKeyword/RemoveInKeywordCodeFixProviderTests.cs index 859789cef9844..69748e632a63c 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/RemoveInKeyword/RemoveInKeywordCodeFixProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/RemoveInKeyword/RemoveInKeywordCodeFixProviderTests.cs @@ -8,12 +8,18 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.RemoveInKeyword { [Trait(Traits.Feature, Traits.Features.CodeActionsRemoveInKeyword)] public class RemoveInKeywordCodeFixProviderTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveInKeywordCodeFixProviderTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new RemoveInKeywordCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/RemoveNewModifier/RemoveNewModifierCodeFixProviderTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/RemoveNewModifier/RemoveNewModifierCodeFixProviderTests.cs index 2c1355ffdb2f0..1e0816018b6e4 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/RemoveNewModifier/RemoveNewModifierCodeFixProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/RemoveNewModifier/RemoveNewModifierCodeFixProviderTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -8,12 +8,18 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.RemoveNewModifier { [Trait(Traits.Feature, Traits.Features.CodeActionsRemoveNewModifier)] public class RemoveNewModifierCodeFixProviderTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveNewModifierCodeFixProviderTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new RemoveNewModifierCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/SpellCheck/SpellCheckTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/SpellCheck/SpellCheckTests.cs index b8701332ee218..585ed7756ca22 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/SpellCheck/SpellCheckTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/SpellCheck/SpellCheckTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.SpellCheck { public class SpellCheckTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public SpellCheckTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpSpellCheckCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs index b23f35ef392f8..d86c9df4ccf7e 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs @@ -27,6 +27,7 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessarySuppressions { @@ -34,6 +35,11 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessarySuppre [WorkItem(44177, "https://github.com/dotnet/roslyn/issues/44177")] public abstract class RemoveUnnecessaryInlineSuppressionsTests : AbstractUnncessarySuppressionDiagnosticTest { + public RemoveUnnecessaryInlineSuppressionsTests(ITestOutputHelper logger) + : base(logger) + { + } + #region Helpers internal sealed override CodeFixProvider CodeFixProvider @@ -119,6 +125,11 @@ public override void Initialize(AnalysisContext context) => public abstract class CompilerOrAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { + public CompilerOrAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + protected abstract bool IsCompilerDiagnosticsTest { get; } protected abstract string VariableDeclaredButNotUsedDiagnosticId { get; } protected abstract string VariableAssignedButNotUsedDiagnosticId { get; } @@ -126,8 +137,14 @@ public abstract class CompilerOrAnalyzerTests : RemoveUnnecessaryInlineSuppressi public sealed class CompilerTests : CompilerOrAnalyzerTests { + public CompilerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override ImmutableArray OtherAnalyzers => ImmutableArray.Create(new CSharpCompilerDiagnosticAnalyzer()); + protected override bool IsCompilerDiagnosticsTest => true; protected override string VariableDeclaredButNotUsedDiagnosticId => "CS0168"; protected override string VariableAssignedButNotUsedDiagnosticId => "CS0219"; @@ -159,6 +176,11 @@ protected override ImmutableArray UnsupportedDiagnosticIds public sealed class AnalyzerTests : CompilerOrAnalyzerTests { + public AnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override ImmutableArray OtherAnalyzers => ImmutableArray.Create(new UserDiagnosticAnalyzer(), new CompilationEndDiagnosticAnalyzer()); protected override bool IsCompilerDiagnosticsTest => false; @@ -989,6 +1011,11 @@ class Class public sealed class CompilerAndAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { + public CompilerAndAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override ImmutableArray OtherAnalyzers => ImmutableArray.Create(new CSharpCompilerDiagnosticAnalyzer(), new UserDiagnosticAnalyzer()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/UpdateProjectToAllowUnsafe/UpdateProjectToAllowUnsafeTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/UpdateProjectToAllowUnsafe/UpdateProjectToAllowUnsafeTests.cs index 46805e4723bbb..af6d026ad9e8e 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/UpdateProjectToAllowUnsafe/UpdateProjectToAllowUnsafeTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/UpdateProjectToAllowUnsafe/UpdateProjectToAllowUnsafeTests.cs @@ -11,12 +11,18 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UpdateProjectToAllowUnsafe { [Trait(Traits.Feature, Traits.Features.CodeActionsUpdateProjectToAllowUnsafe)] public class UpdateProjectToAllowUnsafeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UpdateProjectToAllowUnsafeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpUpdateProjectToAllowUnsafeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs index d5bb9d8e1c25c..6b82621d860b9 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs @@ -14,12 +14,18 @@ using Microsoft.CodeAnalysis.UnitTests; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UpgradeProject { [Trait(Traits.Feature, Traits.Features.CodeActionsUpgradeProject)] public partial class UpgradeProjectTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UpgradeProjectTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpUpgradeProjectCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/DisambiguateSameVariable/DisambiguateSameVariableTests.cs b/src/EditorFeatures/CSharpTest/DisambiguateSameVariable/DisambiguateSameVariableTests.cs index 36e7e1fa33c47..e82e621d472fb 100644 --- a/src/EditorFeatures/CSharpTest/DisambiguateSameVariable/DisambiguateSameVariableTests.cs +++ b/src/EditorFeatures/CSharpTest/DisambiguateSameVariable/DisambiguateSameVariableTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DisambiguateSameVariable { public class DisambiguateSameVariableTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public DisambiguateSameVariableTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpDisambiguateSameVariableCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposableFieldsShouldBeDisposedTests.cs b/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposableFieldsShouldBeDisposedTests.cs index 42c5e717282ea..5fdfd386011ea 100644 --- a/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposableFieldsShouldBeDisposedTests.cs +++ b/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposableFieldsShouldBeDisposedTests.cs @@ -12,12 +12,18 @@ using static Roslyn.Test.Utilities.TestHelpers; using Roslyn.Test.Utilities; using Microsoft.CodeAnalysis.CSharp; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DisposeAnalysis { [Trait(Traits.Feature, Traits.Features.DisposeAnalysis)] public sealed class DisposableFieldsShouldBeDisposedTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public DisposableFieldsShouldBeDisposedTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new DisposableFieldsShouldBeDisposedDiagnosticAnalyzer(isEnabledByDefault: true), null); diff --git a/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposeObjectsBeforeLosingScopeTests.cs b/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposeObjectsBeforeLosingScopeTests.cs index c03d1679822cb..83e0a6864b151 100644 --- a/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposeObjectsBeforeLosingScopeTests.cs +++ b/src/EditorFeatures/CSharpTest/DisposeAnalysis/DisposeObjectsBeforeLosingScopeTests.cs @@ -12,12 +12,18 @@ using static Roslyn.Test.Utilities.TestHelpers; using Roslyn.Test.Utilities; using Microsoft.CodeAnalysis.CSharp; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DisposeAnalysis { [Trait(Traits.Feature, Traits.Features.DisposeAnalysis)] public sealed class DisposeObjectsBeforeLosingScopeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public DisposeObjectsBeforeLosingScopeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new DisposeObjectsBeforeLosingScopeDiagnosticAnalyzer(isEnabledByDefault: true), null); diff --git a/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/AddDocCommentNodesCodeFixProviderTests.cs b/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/AddDocCommentNodesCodeFixProviderTests.cs index 958ca0fa1e561..d420b2358d1a0 100644 --- a/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/AddDocCommentNodesCodeFixProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/AddDocCommentNodesCodeFixProviderTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DocumentationComments.CodeFixes { public class AddDocCommentNodesCodesFixProviderTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public AddDocCommentNodesCodesFixProviderTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpAddDocCommentNodesCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/RemoveDocCommentNodeCodeFixProviderTests.cs b/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/RemoveDocCommentNodeCodeFixProviderTests.cs index 508f25b2930f8..643fadab58f6d 100644 --- a/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/RemoveDocCommentNodeCodeFixProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/DocumentationComments/CodeFixes/RemoveDocCommentNodeCodeFixProviderTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DocumentationComments.CodeFixes { public class RemoveDocCommentNodeCodeFixProviderTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveDocCommentNodeCodeFixProviderTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpRemoveDocCommentNodeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/ValidateRegexStringTests.cs b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/ValidateRegexStringTests.cs index 30e9e54f96688..e0e78b92ce807 100644 --- a/src/EditorFeatures/CSharpTest/EmbeddedLanguages/ValidateRegexStringTests.cs +++ b/src/EditorFeatures/CSharpTest/EmbeddedLanguages/ValidateRegexStringTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.EmbeddedLanguages { public class ValidateRegexStringTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ValidateRegexStringTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRegexDiagnosticAnalyzer(), null); diff --git a/src/EditorFeatures/CSharpTest/Formatting/FormattingAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/Formatting/FormattingAnalyzerTests.cs index de92e7c9e3ad1..ae23fcf1fd9aa 100644 --- a/src/EditorFeatures/CSharpTest/Formatting/FormattingAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/Formatting/FormattingAnalyzerTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Formatting { public class FormattingAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public FormattingAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new FormattingDiagnosticAnalyzer(), new FormattingCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyTests.cs b/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyTests.cs index 308007a9f4e72..75a5b53d0ddc5 100644 --- a/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyTests.cs +++ b/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.FullyQualify { public class FullyQualifyTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public FullyQualifyTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpFullyQualifyCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyUnboundIdentifierTests.cs b/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyUnboundIdentifierTests.cs index 3223b2a17f5be..4c6c31c44d909 100644 --- a/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyUnboundIdentifierTests.cs +++ b/src/EditorFeatures/CSharpTest/FullyQualify/FullyQualifyUnboundIdentifierTests.cs @@ -13,11 +13,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.FullyQualify { public class FullyQualifyUnboundIdentifierTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public FullyQualifyUnboundIdentifierTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUnboundIdentifiersDiagnosticAnalyzer(), new CSharpFullyQualifyCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/GenerateConstructor/GenerateConstructorTests.cs b/src/EditorFeatures/CSharpTest/GenerateConstructor/GenerateConstructorTests.cs index 586f12c6e89a2..e8959c1665f9f 100644 --- a/src/EditorFeatures/CSharpTest/GenerateConstructor/GenerateConstructorTests.cs +++ b/src/EditorFeatures/CSharpTest/GenerateConstructor/GenerateConstructorTests.cs @@ -15,11 +15,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.GenerateConstructor { public class GenerateConstructorTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateConstructorTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new GenerateConstructorCodeFixProvider()); @@ -2747,6 +2753,11 @@ static void Main(string[] args) public partial class GenerateConstructorTestsWithFindMissingIdentifiersAnalyzer : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public GenerateConstructorTestsWithFindMissingIdentifiersAnalyzer(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUnboundIdentifiersDiagnosticAnalyzer(), new GenerateConstructorCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/GenerateVariable/GenerateVariableTests.cs b/src/EditorFeatures/CSharpTest/GenerateVariable/GenerateVariableTests.cs index 4fd9efc667ba4..b69fbc1c7b4ae 100644 --- a/src/EditorFeatures/CSharpTest/GenerateVariable/GenerateVariableTests.cs +++ b/src/EditorFeatures/CSharpTest/GenerateVariable/GenerateVariableTests.cs @@ -18,6 +18,7 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.GenerateVariable { @@ -30,6 +31,11 @@ public class GenerateVariableTests : AbstractCSharpDiagnosticProviderBasedUserDi private const int Parameter = 4; private const int ParameterAndOverrides = 5; + public GenerateVariableTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpGenerateVariableCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs b/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs index 9cec552d1101f..fab14c01fc32c 100644 --- a/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs @@ -16,11 +16,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ImplementAbstractClass { public partial class ImplementAbstractClassTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ImplementAbstractClassTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpImplementAbstractClassCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests_ThroughMember.cs b/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests_ThroughMember.cs index 19bed65ccf11d..738f4d2339287 100644 --- a/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests_ThroughMember.cs +++ b/src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests_ThroughMember.cs @@ -12,12 +12,18 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ImplementAbstractClass { [Trait(Traits.Feature, Traits.Features.CodeActionsImplementAbstractClass)] public sealed class ImplementAbstractClassTests_ThroughMemberTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ImplementAbstractClassTests_ThroughMemberTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpImplementAbstractClassCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index feb44964b44e4..26b4fdeb93ec2 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -16,6 +16,7 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ImplementInterface { @@ -23,6 +24,11 @@ public partial class ImplementInterfaceTests : AbstractCSharpDiagnosticProviderB { private readonly NamingStylesTestOptionSets _options = new NamingStylesTestOptionSets(LanguageNames.CSharp); + public ImplementInterfaceTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpImplementInterfaceCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/MakeClassAbstract/MakeClassAbstractTests.cs b/src/EditorFeatures/CSharpTest/MakeClassAbstract/MakeClassAbstractTests.cs index a7701f81faf92..be7a33430ba6a 100644 --- a/src/EditorFeatures/CSharpTest/MakeClassAbstract/MakeClassAbstractTests.cs +++ b/src/EditorFeatures/CSharpTest/MakeClassAbstract/MakeClassAbstractTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeClassAbstract { public class MakeClassAbstractTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public MakeClassAbstractTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpMakeClassAbstractCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProviderTests.cs b/src/EditorFeatures/CSharpTest/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProviderTests.cs index 5e1c31716ff4d..d4e911b668275 100644 --- a/src/EditorFeatures/CSharpTest/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProviderTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeLocalFunctionStatic { public class PassInCapturedVariablesAsArgumentsCodeFixProviderTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public PassInCapturedVariablesAsArgumentsCodeFixProviderTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new PassInCapturedVariablesAsArgumentsCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/MakeMemberStatic/MakeMemberStaticTests.cs b/src/EditorFeatures/CSharpTest/MakeMemberStatic/MakeMemberStaticTests.cs index 3df825fa437aa..ddbb2198caafe 100644 --- a/src/EditorFeatures/CSharpTest/MakeMemberStatic/MakeMemberStaticTests.cs +++ b/src/EditorFeatures/CSharpTest/MakeMemberStatic/MakeMemberStaticTests.cs @@ -9,11 +9,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeMemberStatic { public class MakeMemberStaticTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public MakeMemberStaticTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpMakeMemberStaticCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/MakeRefStruct/MakeRefStructTests.cs b/src/EditorFeatures/CSharpTest/MakeRefStruct/MakeRefStructTests.cs index 5e8d94ee45df8..040dbc2d707e8 100644 --- a/src/EditorFeatures/CSharpTest/MakeRefStruct/MakeRefStructTests.cs +++ b/src/EditorFeatures/CSharpTest/MakeRefStruct/MakeRefStructTests.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeRefStruct { @@ -21,6 +22,11 @@ public class MakeRefStructTests : AbstractCSharpDiagnosticProviderBasedUserDiagn private static readonly CSharpParseOptions s_parseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7_3); + public MakeRefStructTests(ITestOutputHelper logger) + : base(logger) + { + } + private const string SpanDeclarationSourceText = @" using System; namespace System diff --git a/src/EditorFeatures/CSharpTest/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_AsTests.cs b/src/EditorFeatures/CSharpTest/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_AsTests.cs index 423a2b594e393..263ff0108d2da 100644 --- a/src/EditorFeatures/CSharpTest/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_AsTests.cs +++ b/src/EditorFeatures/CSharpTest/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_AsTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessaryCast { public partial class RemoveUnnecessaryCastTests_AsTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnnecessaryCastTests_AsTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpRemoveUnnecessaryCastDiagnosticAnalyzer(), new CSharpRemoveUnnecessaryCastCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/RemoveUnusedLocalFunction/RemoveUnusedLocalFunctionTests.cs b/src/EditorFeatures/CSharpTest/RemoveUnusedLocalFunction/RemoveUnusedLocalFunctionTests.cs index ce13bf0c7af44..d793773223a78 100644 --- a/src/EditorFeatures/CSharpTest/RemoveUnusedLocalFunction/RemoveUnusedLocalFunctionTests.cs +++ b/src/EditorFeatures/CSharpTest/RemoveUnusedLocalFunction/RemoveUnusedLocalFunctionTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnusedLocalFunction { public partial class RemoveUnusedLocalFunctionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnusedLocalFunctionTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpRemoveUnusedLocalFunctionCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/RemoveUnusedVariable/RemoveUnusedVariableTests.cs b/src/EditorFeatures/CSharpTest/RemoveUnusedVariable/RemoveUnusedVariableTests.cs index bda990e07161e..4c337e6b3c4a1 100644 --- a/src/EditorFeatures/CSharpTest/RemoveUnusedVariable/RemoveUnusedVariableTests.cs +++ b/src/EditorFeatures/CSharpTest/RemoveUnusedVariable/RemoveUnusedVariableTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnusedVariable { public partial class RemoveUnusedVariableTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public RemoveUnusedVariableTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpRemoveUnusedVariableCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/ReplaceDefaultLiteral/ReplaceDefaultLiteralTests.cs b/src/EditorFeatures/CSharpTest/ReplaceDefaultLiteral/ReplaceDefaultLiteralTests.cs index 956d3fd17b6dc..bbe05214f19fa 100644 --- a/src/EditorFeatures/CSharpTest/ReplaceDefaultLiteral/ReplaceDefaultLiteralTests.cs +++ b/src/EditorFeatures/CSharpTest/ReplaceDefaultLiteral/ReplaceDefaultLiteralTests.cs @@ -11,12 +11,18 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ReplaceDefaultLiteral { [Trait(Traits.Feature, Traits.Features.CodeActionsReplaceDefaultLiteral)] public sealed class ReplaceDefaultLiteralTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public ReplaceDefaultLiteralTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpReplaceDefaultLiteralCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/SimplifyThisOrMe/SimplifyThisOrMeTests.cs b/src/EditorFeatures/CSharpTest/SimplifyThisOrMe/SimplifyThisOrMeTests.cs index 9a246e84e885d..679ea67b0d432 100644 --- a/src/EditorFeatures/CSharpTest/SimplifyThisOrMe/SimplifyThisOrMeTests.cs +++ b/src/EditorFeatures/CSharpTest/SimplifyThisOrMe/SimplifyThisOrMeTests.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SimplifyThisOrMe { public partial class SimplifyThisOrMeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public SimplifyThisOrMeTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpSimplifyThisOrMeDiagnosticAnalyzer(), new CSharpSimplifyThisOrMeCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/SimplifyTypeNames/SimplifyTypeNamesTests.cs b/src/EditorFeatures/CSharpTest/SimplifyTypeNames/SimplifyTypeNamesTests.cs index d11e050e305d5..289931f7b78f6 100644 --- a/src/EditorFeatures/CSharpTest/SimplifyTypeNames/SimplifyTypeNamesTests.cs +++ b/src/EditorFeatures/CSharpTest/SimplifyTypeNames/SimplifyTypeNamesTests.cs @@ -17,11 +17,17 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SimplifyTypeNames { public partial class SimplifyTypeNamesTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public SimplifyTypeNamesTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpSimplifyTypeNamesDiagnosticAnalyzer(), new SimplifyTypeNamesCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/UnsealClass/UnsealClassTests.cs b/src/EditorFeatures/CSharpTest/UnsealClass/UnsealClassTests.cs index 515daaf757921..d876c0a76ac9f 100644 --- a/src/EditorFeatures/CSharpTest/UnsealClass/UnsealClassTests.cs +++ b/src/EditorFeatures/CSharpTest/UnsealClass/UnsealClassTests.cs @@ -9,12 +9,18 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UnsealClass { [Trait(Traits.Feature, Traits.Features.CodeActionsUnsealClass)] public sealed class UnsealClassTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UnsealClassTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpUnsealClassCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/UseExplicitTypeForConst/UseExplicitTypeForConstTests.cs b/src/EditorFeatures/CSharpTest/UseExplicitTypeForConst/UseExplicitTypeForConstTests.cs index 7e88dc53ecc60..dbaccb37adc7f 100644 --- a/src/EditorFeatures/CSharpTest/UseExplicitTypeForConst/UseExplicitTypeForConstTests.cs +++ b/src/EditorFeatures/CSharpTest/UseExplicitTypeForConst/UseExplicitTypeForConstTests.cs @@ -9,12 +9,18 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExplicitTypeForConst { [Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitTypeForConst)] public sealed class UseExplicitTypeForConstTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExplicitTypeForConstTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new UseExplicitTypeForConstCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/UseExpressionBodyForLambda/UseExpressionBodyForLambdasAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/UseExpressionBodyForLambda/UseExpressionBodyForLambdasAnalyzerTests.cs index 852b4af2c4b2d..b049f30bbb4b8 100644 --- a/src/EditorFeatures/CSharpTest/UseExpressionBodyForLambda/UseExpressionBodyForLambdasAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/UseExpressionBodyForLambda/UseExpressionBodyForLambdasAnalyzerTests.cs @@ -11,11 +11,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForLambdasAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public UseExpressionBodyForLambdasAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseExpressionBodyForLambdaDiagnosticAnalyzer(), new UseExpressionBodyForLambdaCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs b/src/EditorFeatures/CSharpTest/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs index c4e90ee79fa89..18eeb5f5188ed 100644 --- a/src/EditorFeatures/CSharpTest/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs +++ b/src/EditorFeatures/CSharpTest/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs @@ -10,12 +10,18 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseInterpolatedVerbatimString { [Trait(Traits.Feature, Traits.Features.CodeActionsUseInterpolatedVerbatimString)] public class CSharpUseInterpolatedVerbatimStringCodeFixTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpUseInterpolatedVerbatimStringCodeFixTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (null, new CSharpUseInterpolatedVerbatimStringCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs index d36913655c109..1bca7af4cc529 100644 --- a/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UsePatternCombinators { @@ -27,6 +28,11 @@ public class CSharpUsePatternCombinatorsDiagnosticAnalyzerTests : AbstractCSharp { CSharpCodeStyleOptions.PreferPatternMatching, new CodeStyleOption2(false, NotificationOption2.None) } }; + public CSharpUsePatternCombinatorsDiagnosticAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUsePatternCombinatorsDiagnosticAnalyzer(), new CSharpUsePatternCombinatorsCodeFixProvider()); diff --git a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzerTests.cs index 64c15af788dd0..1196b4669e4e5 100644 --- a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzerTests.cs @@ -10,11 +10,17 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UsePatternMatching { public partial class CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzerTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { + public CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzerTests(ITestOutputHelper logger) + : base(logger) + { + } + internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer(), new CSharpIsAndCastCheckWithoutNameCodeFixProvider()); diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs index 617cc1e00ef1b..a1d37046a2768 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Remote.Testing; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; @@ -25,6 +26,7 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; +using Xunit.Abstractions; #if CODE_STYLE using System.Diagnostics; @@ -97,6 +99,15 @@ public TestParameters WithIncludeDiagnosticsOutsideSelection(bool includeDiagnos => new TestParameters(parseOptions, compilationOptions, options, fixProviderData, index, priority, retainNonFixableDiagnostics, includeDiagnosticsOutsideSelection, title, testHost); } +#pragma warning disable IDE0052 // Remove unread private members (unused when CODE_STYLE is set) + private readonly ITestOutputHelper _logger; +#pragma warning restore + + public AbstractCodeActionOrUserDiagnosticTest(ITestOutputHelper logger = null) + { + _logger = logger; + } + private const string AutoGeneratedAnalyzerConfigHeader = @"# auto-generated .editorconfig for code style options"; protected internal abstract string GetLanguage(); @@ -123,6 +134,13 @@ protected TestWorkspace CreateWorkspaceFromOptions(string workspaceMarkupOrCode, TestWorkspace.Create(workspaceMarkupOrCode, openDocuments: false, composition: composition) : TestWorkspace.Create(GetLanguage(), parameters.compilationOptions, parameters.parseOptions, files: new[] { workspaceMarkupOrCode }, composition: composition); +#if !CODE_STYLE + if (parameters.testHost == TestHost.OutOfProcess && _logger != null) + { + var remoteHostProvider = (InProcRemoteHostClientProvider)workspace.Services.GetRequiredService(); + remoteHostProvider.TraceListener = new XunitTraceListener(_logger); + } +#endif InitializeWorkspace(workspace, parameters); // For CodeStyle layer testing, we create an .editorconfig at project root diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs index b67be559d9c42..5ff8d494b6f70 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs @@ -21,13 +21,18 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics { public abstract partial class AbstractDiagnosticProviderBasedUserDiagnosticTest : AbstractUserDiagnosticTest { - private readonly ConcurrentDictionary _analyzerAndFixerMap = - new ConcurrentDictionary(); + private readonly ConcurrentDictionary _analyzerAndFixerMap = new(); + + public AbstractDiagnosticProviderBasedUserDiagnosticTest(ITestOutputHelper logger) + : base(logger) + { + } internal abstract (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace); diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs index e51dca83aca70..1a02598c3c262 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs @@ -16,11 +16,17 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.UnitTests.Diagnostics; using Roslyn.Utilities; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics { public abstract class AbstractSuppressionDiagnosticTest : AbstractUserDiagnosticTest { + public AbstractSuppressionDiagnosticTest(ITestOutputHelper logger = null) + : base(logger) + { + } + protected abstract int CodeActionIndex { get; } protected virtual bool IncludeSuppressedDiagnostics => false; protected virtual bool IncludeUnsuppressedDiagnostics => true; diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUnncessarySuppressionDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUnncessarySuppressionDiagnosticTest.cs index 37399640b0c6a..8f8e8abf18e70 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUnncessarySuppressionDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUnncessarySuppressionDiagnosticTest.cs @@ -12,11 +12,17 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions; using Microsoft.CodeAnalysis.UnitTests.Diagnostics; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics { public abstract class AbstractUnncessarySuppressionDiagnosticTest : AbstractUserDiagnosticTest { + public AbstractUnncessarySuppressionDiagnosticTest(ITestOutputHelper logger) + : base(logger) + { + } + internal abstract CodeFixProvider CodeFixProvider { get; } internal abstract AbstractRemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer SuppressionAnalyzer { get; } internal abstract ImmutableArray OtherAnalyzers { get; } diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs index 7649e74d2c8fb..52b39166dd4ad 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs @@ -22,11 +22,17 @@ using Xunit; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Remote.Testing; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics { public abstract partial class AbstractUserDiagnosticTest : AbstractCodeActionOrUserDiagnosticTest { + public AbstractUserDiagnosticTest(ITestOutputHelper logger) + : base(logger) + { + } + internal abstract Task<(ImmutableArray, ImmutableArray, CodeAction actionToInvoke)> GetDiagnosticAndFixesAsync( TestWorkspace workspace, TestParameters parameters); diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest_GenerateTypeDialog.cs b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest_GenerateTypeDialog.cs index 916eb3f410b21..ca9a12a76eccc 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest_GenerateTypeDialog.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest_GenerateTypeDialog.cs @@ -21,7 +21,7 @@ namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics { - public abstract partial class AbstractUserDiagnosticTest : AbstractCodeActionOrUserDiagnosticTest + public abstract partial class AbstractUserDiagnosticTest { // TODO: IInlineRenameService requires WPF (https://github.com/dotnet/roslyn/issues/46153) private static readonly TestComposition s_composition = EditorTestCompositions.EditorFeaturesWpf diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest.vb b/src/EditorFeatures/VisualBasicTest/Diagnostics/AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest.vb index b5fb40497b99b..9bb40cb8e3ef3 100644 --- a/src/EditorFeatures/VisualBasicTest/Diagnostics/AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest.vb +++ b/src/EditorFeatures/VisualBasicTest/Diagnostics/AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest.vb @@ -5,6 +5,7 @@ Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics Imports Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics @@ -14,6 +15,10 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics Private ReadOnly _compilationOptions As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionInfer(True).WithParseOptions(New VisualBasicParseOptions(LanguageVersion.Latest)) + Public Sub New(Optional logger As ITestOutputHelper = Nothing) + MyBase.New(logger) + End Sub + Protected Overrides Function GetScriptOptions() As ParseOptions Return TestOptions.Script End Function diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.vb b/src/EditorFeatures/VisualBasicTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.vb index 8f8bc0743ef67..ea6f8a0d09dca 100644 --- a/src/EditorFeatures/VisualBasicTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.vb @@ -12,6 +12,7 @@ Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions Imports Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessarySuppressions +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.RemoveUnnecessarySuppressions @@ -20,6 +21,10 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.Remove Public NotInheritable Class RemoveUnnecessaryInlineSuppressionsTests Inherits AbstractUnncessarySuppressionDiagnosticTest + Public Sub New(logger As ITestOutputHelper) + MyBase.New(logger) + End Sub + Protected Overrides Function GetScriptOptions() As ParseOptions Return TestOptions.Script End Function diff --git a/src/Test/Utilities/Portable/Assert/XunitTraceListener.cs b/src/Test/Utilities/Portable/Assert/XunitTraceListener.cs new file mode 100644 index 0000000000000..372e6a8a2f9cf --- /dev/null +++ b/src/Test/Utilities/Portable/Assert/XunitTraceListener.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable enable + +using System.Diagnostics; +using System.Text; +using Xunit.Abstractions; + +namespace Roslyn.Test.Utilities +{ + public sealed class XunitTraceListener : TraceListener + { + private readonly ITestOutputHelper _logger; + private readonly StringBuilder _lineInProgress = new StringBuilder(); + private bool _disposed; + + public XunitTraceListener(ITestOutputHelper logger) + => _logger = logger; + + public override bool IsThreadSafe + => false; + + public override void Write(string? message) + => _lineInProgress.Append(message); + + public override void WriteLine(string? message) + { + if (!_disposed) + { + _logger.WriteLine(_lineInProgress.ToString() + message); + _lineInProgress.Clear(); + } + } + + protected override void Dispose(bool disposing) + { + _disposed = true; + base.Dispose(disposing); + } + } +} diff --git a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj index e4a8abe955557..6c10dd4c92f98 100644 --- a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj @@ -25,6 +25,7 @@ + diff --git a/src/Workspaces/Core/Portable/Remote/RemoteHostClient.cs b/src/Workspaces/Core/Portable/Remote/RemoteHostClient.cs index 3eaa1bd0125cc..806a7d45472c7 100644 --- a/src/Workspaces/Core/Portable/Remote/RemoteHostClient.cs +++ b/src/Workspaces/Core/Portable/Remote/RemoteHostClient.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Roslyn.Utilities; @@ -108,12 +109,12 @@ public async ValueTask> TryInvokeAsync( } /// - /// Invokes a remote API that streams results back to the caller. + /// Invokes a remote API that streams data back to the caller via a pipe. /// public async ValueTask> TryInvokeAsync( Solution solution, - Func invocation, - Func> reader, + Func invocation, + Func> reader, object? callbackTarget, CancellationToken cancellationToken) where TService : class diff --git a/src/Workspaces/Core/Portable/Remote/RemoteServiceConnection.cs b/src/Workspaces/Core/Portable/Remote/RemoteServiceConnection.cs index 5d94f0cbafd91..620bb2bbe4cbe 100644 --- a/src/Workspaces/Core/Portable/Remote/RemoteServiceConnection.cs +++ b/src/Workspaces/Core/Portable/Remote/RemoteServiceConnection.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; @@ -44,8 +45,8 @@ public abstract ValueTask> TryInvokeAsync( CancellationToken cancellationToken); public abstract ValueTask> TryInvokeAsync( - Func invocation, - Func> reader, + Func invocation, + Func> reader, CancellationToken cancellationToken); public abstract ValueTask TryInvokeAsync( @@ -60,8 +61,8 @@ public abstract ValueTask> TryInvokeAsync( public abstract ValueTask> TryInvokeAsync( Solution solution, - Func invocation, - Func> reader, + Func invocation, + Func> reader, CancellationToken cancellationToken); } } diff --git a/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs b/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs index 15df12c257f50..cd535d37c0350 100644 --- a/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs +++ b/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.IO; +using System.IO.Pipelines; using System.Linq; using System.Reflection; using System.Runtime.Serialization; @@ -98,8 +99,11 @@ void AddTypeRecursive(Type type, MemberInfo declaringMember) foreach (var type in method.GetParameters().Select(p => p.ParameterType)) { - // stream is special cased by JSON-RPC for streaming APIs - if (type != typeof(Stream)) + // types that are special cased by JSON-RPC for streaming APIs + if (type != typeof(Stream) && + type != typeof(IDuplexPipe) && + type != typeof(PipeReader) && + type != typeof(PipeWriter)) { AddTypeRecursive(type, method); } diff --git a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs index f22a39812ee6d..4602e49d72aac 100644 --- a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs +++ b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs @@ -34,9 +34,9 @@ internal sealed partial class InProcRemoteHostClient : RemoteHostClient, IRemote private readonly RemoteEndPoint _endPoint; private readonly TraceSource _logger; - public static async Task CreateAsync(HostWorkspaceServices services, RemoteHostTestData testData) + public static async Task CreateAsync(HostWorkspaceServices services, TraceListener? traceListener, RemoteHostTestData testData) { - var inprocServices = new InProcRemoteServices(services, testData); + var inprocServices = new InProcRemoteServices(services, traceListener, testData); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownServiceHubService.RemoteHost).ConfigureAwait(false); @@ -191,7 +191,9 @@ public event EventHandler? AvailabilityChanged { var pipePair = FullDuplexStream.CreatePipePair(); - var clientConnection = descriptor.ConstructRpcConnection(pipePair.Item2); + var clientConnection = descriptor + .WithTraceSource(_services.ServiceProvider.TraceSource) + .ConstructRpcConnection(pipePair.Item2); Contract.ThrowIfFalse(options.ClientRpcTarget is null == descriptor.ClientInterface is null); @@ -218,7 +220,7 @@ public event EventHandler? AvailabilityChanged private sealed class InProcRemoteServices { - private readonly ServiceProvider _serviceProvider; + public readonly ServiceProvider ServiceProvider; private readonly Dictionary> _inProcBrokeredServicesMap = new(); private readonly Dictionary _remoteBrokeredServicesMap = new(); private readonly Dictionary> _factoryMap = new(); @@ -226,11 +228,19 @@ private sealed class InProcRemoteServices public readonly IServiceBroker ServiceBroker; - public InProcRemoteServices(HostWorkspaceServices workspaceServices, RemoteHostTestData testData) + public InProcRemoteServices(HostWorkspaceServices workspaceServices, TraceListener? traceListener, RemoteHostTestData testData) { - var remoteLogger = new TraceSource("inprocRemoteClient"); + var remoteLogger = new TraceSource("InProcRemoteClient") + { + Switch = { Level = SourceLevels.Verbose }, + }; + + if (traceListener != null) + { + remoteLogger.Listeners.Add(traceListener); + } - _serviceProvider = new ServiceProvider(remoteLogger, testData); + ServiceProvider = new ServiceProvider(remoteLogger, testData); ServiceBroker = new InProcServiceBroker(this); @@ -258,7 +268,7 @@ public InProcRemoteServices(HostWorkspaceServices workspaceServices, RemoteHostT RegisterService(WellKnownServiceHubService.LanguageServer, (s, p, o) => new LanguageServer(s, p)); } - public RemoteHostTestData TestData => _serviceProvider.TestData; + public RemoteHostTestData TestData => ServiceProvider.TestData; public void RegisterService(RemoteServiceName name, Func serviceFactory) { @@ -270,7 +280,7 @@ public Task RequestServiceAsync(RemoteServiceName serviceName) { var factory = _factoryMap[serviceName]; var streams = FullDuplexStream.CreatePair(); - return Task.FromResult(new WrappedStream(factory(streams.Item1, _serviceProvider, default), streams.Item2)); + return Task.FromResult(new WrappedStream(factory(streams.Item1, ServiceProvider, default), streams.Item2)); } public void RegisterInProcBrokeredService(ServiceDescriptor serviceDescriptor, Func serviceFactory) @@ -292,7 +302,7 @@ public object CreateBrokeredService(ServiceRpcDescriptor descriptor, IDuplexPipe // Currently don't support callback creation as we don't have in-proc service with callbacks yet. Contract.ThrowIfFalse(descriptor.ClientInterface == null); - var serviceConnection = descriptor.WithTraceSource(_serviceProvider.TraceSource).ConstructRpcConnection(pipe); + var serviceConnection = descriptor.WithTraceSource(ServiceProvider.TraceSource).ConstructRpcConnection(pipe); var service = inProcFactory(); serviceConnection.AddLocalRpcTarget(service); @@ -303,7 +313,7 @@ public object CreateBrokeredService(ServiceRpcDescriptor descriptor, IDuplexPipe if (_remoteBrokeredServicesMap.TryGetValue(descriptor.Moniker, out var remoteFactory)) { - return remoteFactory.Create(pipe, _serviceProvider, options, ServiceBroker); + return remoteFactory.Create(pipe, ServiceProvider, options, ServiceBroker); } throw ExceptionUtilities.UnexpectedValue(descriptor.Moniker); diff --git a/src/Workspaces/CoreTestUtilities/Remote/InProcRemoteHostClientProvider.cs b/src/Workspaces/CoreTestUtilities/Remote/InProcRemoteHostClientProvider.cs index 8076e2f10614d..87678ea43f6bb 100644 --- a/src/Workspaces/CoreTestUtilities/Remote/InProcRemoteHostClientProvider.cs +++ b/src/Workspaces/CoreTestUtilities/Remote/InProcRemoteHostClientProvider.cs @@ -6,6 +6,7 @@ using System; using System.Composition; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; @@ -50,6 +51,7 @@ public override RemoteWorkspace GetWorkspace() public SolutionAssetCache? RemoteAssetStorage { get; } public Type[]? AdditionalRemoteParts { get; } + public TraceListener? TraceListener { get; set; } public InProcRemoteHostClientProvider(HostWorkspaceServices services) { @@ -58,6 +60,7 @@ public InProcRemoteHostClientProvider(HostWorkspaceServices services) _lazyClient = new AsyncLazy( cancellationToken => InProcRemoteHostClient.CreateAsync( _services, + TraceListener, new RemoteHostTestData( new WorkspaceManager(RemoteAssetStorage ?? new SolutionAssetCache(), AdditionalRemoteParts), isInProc: true)), diff --git a/src/Workspaces/Remote/Core/BrokeredServiceConnection.cs b/src/Workspaces/Remote/Core/BrokeredServiceConnection.cs index 15accfa6d8154..76f97b22b5f7f 100644 --- a/src/Workspaces/Remote/Core/BrokeredServiceConnection.cs +++ b/src/Workspaces/Remote/Core/BrokeredServiceConnection.cs @@ -5,7 +5,9 @@ #nullable enable using System; +using System.Diagnostics; using System.IO; +using System.IO.Pipelines; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; @@ -15,6 +17,7 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Nerdbank.Streams; +using Roslyn.Utilities; using StreamJsonRpc; using StreamJsonRpc.Protocol; @@ -73,8 +76,8 @@ public override async ValueTask> TryInvokeAsync(Func< } public override async ValueTask> TryInvokeAsync( - Func invocation, - Func> reader, + Func invocation, + Func> reader, CancellationToken cancellationToken) { try @@ -121,8 +124,8 @@ public override async ValueTask> TryInvokeAsync(Solut public override async ValueTask> TryInvokeAsync( Solution solution, - Func invocation, - Func> reader, + Func invocation, + Func> reader, CancellationToken cancellationToken) { try @@ -130,7 +133,7 @@ public override async ValueTask> TryInvokeAsync( using var scope = await _solutionAssetStorage.StoreAssetsAsync(solution, cancellationToken).ConfigureAwait(false); return await InvokeStreamingServiceAsync( _service, - (service, stream, cancellationToken) => invocation(service, scope.SolutionInfo, stream, cancellationToken), + (service, pipeWriter, cancellationToken) => invocation(service, scope.SolutionInfo, pipeWriter, cancellationToken), reader, cancellationToken).ConfigureAwait(false); } @@ -143,19 +146,51 @@ public override async ValueTask> TryInvokeAsync( internal static async ValueTask InvokeStreamingServiceAsync( TService service, - Func invocation, - Func> reader, + Func invocation, + Func> reader, CancellationToken cancellationToken) { - // The reader should close the client stream, the writer will close the server stream. - // See https://github.com/microsoft/vs-streamjsonrpc/blob/master/doc/oob_streams.md - var (clientStream, serverStream) = FullDuplexStream.CreatePair(); - - // Create new tasks that both start executing, rather than invoking the delegates directly. - // If the reader started synchronously reading before the writer task started it would be blocking, and vice versa - // if the writer synchronously filled the buffer before the reader task started it would also be blocking. - var writerTask = Task.Run(async () => await invocation(service, serverStream, cancellationToken).ConfigureAwait(false), cancellationToken); - var readerTask = Task.Run(async () => await reader(clientStream, cancellationToken).ConfigureAwait(false), cancellationToken); + var pipe = new Pipe(); + + // Create new tasks that both start executing, rather than invoking the delegates directly + // to make sure both invocation and reader start executing and transfering data. + + var writerTask = Task.Run(async () => + { + try + { + await invocation(service, pipe.Writer, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + // Ensure that the writer is complete if an exception is thrown + // before the writer is passed to the RPC proxy. Once it's passed to the proxy + // the proxy should complete it as soon as the remote side completes it. + await pipe.Writer.CompleteAsync(e).ConfigureAwait(false); + + throw; + } + }, cancellationToken); + + var readerTask = Task.Run( + async () => + { + Exception? exception = null; + + try + { + return await reader(pipe.Reader, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) when ((exception = e) == null) + { + throw ExceptionUtilities.Unreachable; + } + finally + { + await pipe.Reader.CompleteAsync(exception).ConfigureAwait(false); + } + }, cancellationToken); + await Task.WhenAll(writerTask, readerTask).ConfigureAwait(false); return readerTask.Result; @@ -163,6 +198,16 @@ internal static async ValueTask InvokeStreamingServiceAsync( private bool ReportUnexpectedException(Exception exception, CancellationToken cancellationToken) { + if (exception is OperationCanceledException) + { + // It's a bug for a service to throw OCE based on a different cancellation token than it has received in the call. + // The server side filter will report NFW in such scenario, so that the underlying issue can be fixed. + // Do not treat this as a critical failure of the service for now and only fail in debug build. + Debug.Assert(cancellationToken.IsCancellationRequested); + + return false; + } + // Do not report telemetry when the host is shutting down or the remote service threw an IO exception: if (IsHostShuttingDown || IsRemoteIOException(exception)) { @@ -172,7 +217,7 @@ private bool ReportUnexpectedException(Exception exception, CancellationToken ca // report telemetry event: Logger.Log(FunctionId.FeatureNotAvailable, $"{ServiceDescriptors.GetServiceName(typeof(TService))}: {exception.GetType()}: {exception.Message}"); - return FatalError.ReportWithoutCrashUnlessCanceled(exception, cancellationToken); + return FatalError.ReportWithoutCrash(exception); } private bool IsHostShuttingDown diff --git a/src/Workspaces/Remote/Core/ISolutionAssetProvider.cs b/src/Workspaces/Remote/Core/ISolutionAssetProvider.cs index 2c08dcf910f60..50cc9f111a18c 100644 --- a/src/Workspaces/Remote/Core/ISolutionAssetProvider.cs +++ b/src/Workspaces/Remote/Core/ISolutionAssetProvider.cs @@ -6,6 +6,7 @@ using System.Collections.Immutable; using System.IO; +using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; @@ -19,7 +20,7 @@ internal interface ISolutionAssetProvider /// /// Streams serialized assets into the given stream. /// - ValueTask GetAssetsAsync(Stream outputStream, int scopeId, Checksum[] checksums, CancellationToken cancellationToken); + ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checksum[] checksums, CancellationToken cancellationToken); // TODO: remove (https://github.com/dotnet/roslyn/issues/43477) ValueTask IsExperimentEnabledAsync(string experimentName, CancellationToken cancellationToken); diff --git a/src/Workspaces/Remote/Core/RemoteCallback.cs b/src/Workspaces/Remote/Core/RemoteCallback.cs index 941efd4404637..677683085da28 100644 --- a/src/Workspaces/Remote/Core/RemoteCallback.cs +++ b/src/Workspaces/Remote/Core/RemoteCallback.cs @@ -6,6 +6,7 @@ using System; using System.IO; +using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using MessagePack; @@ -65,8 +66,8 @@ public async ValueTask InvokeAsync(Func public async ValueTask InvokeAsync( - Func invocation, - Func> reader, + Func invocation, + Func> reader, CancellationToken cancellationToken) { try diff --git a/src/Workspaces/Remote/Core/RemoteHostAssetSerialization.cs b/src/Workspaces/Remote/Core/RemoteHostAssetSerialization.cs index 86bde237f2138..d7259d149d0a4 100644 --- a/src/Workspaces/Remote/Core/RemoteHostAssetSerialization.cs +++ b/src/Workspaces/Remote/Core/RemoteHostAssetSerialization.cs @@ -12,12 +12,42 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Serialization; using Roslyn.Utilities; +using System; +using System.IO.Pipelines; +using Microsoft.VisualStudio.Threading; +using System.Diagnostics; namespace Microsoft.CodeAnalysis.Remote { internal static class RemoteHostAssetSerialization { + internal static readonly PipeOptions PipeOptionsWithUnlimitedWriterBuffer = new(pauseWriterThreshold: long.MaxValue); + public static async Task WriteDataAsync(ObjectWriter writer, SolutionAssetStorage assetStorage, ISerializerService serializer, int scopeId, Checksum[] checksums, CancellationToken cancellationToken) + { + SolutionAsset? singleAsset = null; + IReadOnlyDictionary? assetMap = null; + + if (checksums.Length == 1) + { + singleAsset = (await assetStorage.GetAssetAsync(scopeId, checksums[0], cancellationToken).ConfigureAwait(false)) ?? SolutionAsset.Null; + } + else + { + assetMap = await assetStorage.GetAssetsAsync(scopeId, checksums, cancellationToken).ConfigureAwait(false); + } + + WriteData(writer, singleAsset, assetMap, serializer, scopeId, checksums, cancellationToken); + } + + public static void WriteData( + ObjectWriter writer, + SolutionAsset? singleAsset, + IReadOnlyDictionary? assetMap, + ISerializerService serializer, + int scopeId, + Checksum[] checksums, + CancellationToken cancellationToken) { writer.WriteInt32(scopeId); @@ -28,21 +58,17 @@ public static async Task WriteDataAsync(ObjectWriter writer, SolutionAssetStorag return; } - if (checksums.Length == 1) + if (singleAsset != null) { - var checksum = checksums[0]; - - var asset = (await assetStorage.GetAssetAsync(scopeId, checksum, cancellationToken).ConfigureAwait(false)) ?? SolutionAsset.Null; writer.WriteInt32(1); - - WriteAsset(writer, serializer, checksum, asset, cancellationToken); + WriteAsset(writer, serializer, checksums[0], singleAsset, cancellationToken); return; } - var assets = await assetStorage.GetAssetsAsync(scopeId, checksums, cancellationToken).ConfigureAwait(false); - writer.WriteInt32(assets.Count); + Debug.Assert(assetMap != null); + writer.WriteInt32(assetMap.Count); - foreach (var (checksum, asset) in assets) + foreach (var (checksum, asset) in assetMap) { WriteAsset(writer, serializer, checksum, asset, cancellationToken); } @@ -60,15 +86,54 @@ static void WriteAsset(ObjectWriter writer, ISerializerService serializer, Check } } - public static ValueTask> ReadDataAsync(Stream stream, int scopeId, ISet checksums, ISerializerService serializerService, CancellationToken cancellationToken) + public static ValueTask> ReadDataAsync(PipeReader pipeReader, int scopeId, ISet checksums, ISerializerService serializerService, CancellationToken cancellationToken) { - using var _ = ArrayBuilder<(Checksum, object)>.GetInstance(out var results); + // Workaround for ObjectReader not supporting async reading. + // Unless we read from the RPC stream asynchronously and with cancallation support we might hang when the server cancels. + // https://github.com/dotnet/roslyn/issues/47861 + + // Use local pipe to avoid blocking the current thread on networking IO. + var localPipe = new Pipe(PipeOptionsWithUnlimitedWriterBuffer); + + Exception? exception = null; - using var reader = ObjectReader.TryGetReader(stream, leaveOpen: true, cancellationToken); + // start a task on a thread pool thread copying from the RPC pipe to a local pipe: + Task.Run(async () => + { + try + { + await pipeReader.CopyToAsync(localPipe.Writer, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + exception = e; + } + finally + { + await localPipe.Writer.CompleteAsync(exception).ConfigureAwait(false); + await pipeReader.CompleteAsync(exception).ConfigureAwait(false); + } + }, cancellationToken).Forget(); + + // blocking read from the local pipe on the current thread: + try + { + using var stream = localPipe.Reader.AsStream(leaveOpen: false); + return new(ReadData(stream, scopeId, checksums, serializerService, cancellationToken)); + } + catch (EndOfStreamException) + { + cancellationToken.ThrowIfCancellationRequested(); + + throw exception ?? ExceptionUtilities.Unreachable; + } + } + + public static ImmutableArray<(Checksum, object)> ReadData(Stream stream, int scopeId, ISet checksums, ISerializerService serializerService, CancellationToken cancellationToken) + { + using var _ = ArrayBuilder<(Checksum, object)>.GetInstance(out var results); - // We only get a reader for data transmitted between live processes. - // This data should always be correct as we're never persisting the data between sessions. - Contract.ThrowIfNull(reader); + using var reader = ObjectReader.GetReader(stream, leaveOpen: true, cancellationToken); var responseScopeId = reader.ReadInt32(); Contract.ThrowIfFalse(scopeId == responseScopeId); @@ -89,7 +154,7 @@ static void WriteAsset(ObjectWriter writer, ISerializerService serializer, Check results.Add((responseChecksum, result)); } - return new(results.ToImmutable()); + return results.ToImmutable(); } } } diff --git a/src/Workspaces/Remote/Core/SolutionAssetProvider.cs b/src/Workspaces/Remote/Core/SolutionAssetProvider.cs index 2677eca2d6262..ae3284f1fb188 100644 --- a/src/Workspaces/Remote/Core/SolutionAssetProvider.cs +++ b/src/Workspaces/Remote/Core/SolutionAssetProvider.cs @@ -4,15 +4,21 @@ #nullable enable +using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.IO.Pipelines; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Experiments; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Serialization; +using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; +using Nerdbank.Streams; namespace Microsoft.CodeAnalysis.Remote { @@ -29,20 +35,67 @@ public SolutionAssetProvider(HostWorkspaceServices services) _services = services; } - public ValueTask GetAssetsAsync(Stream outputStream, int scopeId, Checksum[] checksums, CancellationToken cancellationToken) + public async ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checksum[] checksums, CancellationToken cancellationToken) { - // Complete RPC right away so the client can start reading from the stream. - // The fire-and forget task starts writing to the output stream and the client will read it until it reads all expected data. - _ = Task.Run(async () => + var assetStorage = _services.GetRequiredService().AssetStorage; + var serializer = _services.GetRequiredService(); + + SolutionAsset? singleAsset = null; + IReadOnlyDictionary? assetMap = null; + + if (checksums.Length == 1) { - using var writer = new ObjectWriter(outputStream, leaveOpen: false, cancellationToken); + singleAsset = (await assetStorage.GetAssetAsync(scopeId, checksums[0], cancellationToken).ConfigureAwait(false)) ?? SolutionAsset.Null; + } + else + { + assetMap = await assetStorage.GetAssetsAsync(scopeId, checksums, cancellationToken).ConfigureAwait(false); + } - var assetStorage = _services.GetRequiredService().AssetStorage; - var serializer = _services.GetRequiredService(); - await RemoteHostAssetSerialization.WriteDataAsync(writer, assetStorage, serializer, scopeId, checksums, cancellationToken).ConfigureAwait(false); - }, cancellationToken); + // Work around the lack of async stream writing in ObjectWriter, which is required when writing to the RPC pipe. + // Run two tasks - the first synchronously writes to a local pipe and the second asynchronosly transfers the data to the RPC pipe. + // + // Configure the pipe to never block on write (waiting for the reader to read). This prevents deadlocks but might result in more + // (non-contiguous) memory allocated for the underlying buffers. The amount of memory is bounded by the total size of the serialized assets. + var localPipe = new Pipe(RemoteHostAssetSerialization.PipeOptionsWithUnlimitedWriterBuffer); - return default; + Task.Run(() => + { + try + { + var stream = localPipe.Writer.AsStream(leaveOpen: false); + using var writer = new ObjectWriter(stream, leaveOpen: false, cancellationToken); + RemoteHostAssetSerialization.WriteData(writer, singleAsset, assetMap, serializer, scopeId, checksums, cancellationToken); + } + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e, cancellationToken)) + { + // no-op + } + }, cancellationToken).Forget(); + + // Complete RPC once we send the initial piece of data and start waiting for the writer to send more, + // so the client can start reading from the stream. Once CopyPipeDataAsync completes the pipeWriter + // the corresponding client-side pipeReader will complete and the data transfer will be finished. + CopyPipeDataAsync().Forget(); + + async Task CopyPipeDataAsync() + { + Exception? exception = null; + try + { + await localPipe.Reader.CopyToAsync(pipeWriter, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + FatalError.ReportWithoutCrashUnlessCanceled(e, cancellationToken); + exception = e; + } + finally + { + await localPipe.Reader.CompleteAsync(exception).ConfigureAwait(false); + await pipeWriter.CompleteAsync(exception).ConfigureAwait(false); + } + } } public ValueTask IsExperimentEnabledAsync(string experimentName, CancellationToken cancellationToken) diff --git a/src/Workspaces/Remote/ServiceHub/Host/SolutionAssetSource.cs b/src/Workspaces/Remote/ServiceHub/Host/SolutionAssetSource.cs index 9efb43d94450e..55b70bffafcea 100644 --- a/src/Workspaces/Remote/ServiceHub/Host/SolutionAssetSource.cs +++ b/src/Workspaces/Remote/ServiceHub/Host/SolutionAssetSource.cs @@ -32,8 +32,8 @@ public SolutionAssetSource(ServiceBrokerClient client, CancellationTokenSource c Contract.ThrowIfNull(provider.Proxy); return await new RemoteCallback(provider.Proxy, _clientDisconnectedSource).InvokeAsync( - (proxy, stream, cancellationToken) => proxy.GetAssetsAsync(stream, scopeId, checksums.ToArray(), cancellationToken), - (stream, cancellationToken) => RemoteHostAssetSerialization.ReadDataAsync(stream, scopeId, checksums, serializerService, cancellationToken), + (proxy, pipeWriter, cancellationToken) => proxy.GetAssetsAsync(pipeWriter, scopeId, checksums.ToArray(), cancellationToken), + (pipeReader, cancellationToken) => RemoteHostAssetSerialization.ReadDataAsync(pipeReader, scopeId, checksums, serializerService, cancellationToken), cancellationToken).ConfigureAwait(false); } diff --git a/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs index 1a5965c45d3c8..31c5a8cfab3ff 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs @@ -133,7 +133,7 @@ public void InitializeTelemetrySession(int hostProcessId, string serializedSessi return EndPoint.InvokeAsync( nameof(IRemoteHostServiceCallback.GetAssetsAsync), new object[] { scopeId, checksums.ToArray() }, - (stream, cancellationToken) => RemoteHostAssetSerialization.ReadDataAsync(stream, scopeId, checksums, serializerService, cancellationToken).AsTask(), + (stream, cancellationToken) => Task.FromResult(RemoteHostAssetSerialization.ReadData(stream, scopeId, checksums, serializerService, cancellationToken)), cancellationToken); } }, cancellationToken).ConfigureAwait(false); diff --git a/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostTestData.cs b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostTestData.cs index 619b2a846d965..2988e5ef18ca9 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostTestData.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostTestData.cs @@ -4,9 +4,6 @@ #nullable enable -using System; -using Microsoft.CodeAnalysis.Host; - namespace Microsoft.CodeAnalysis.Remote { ///