From 32e71f5ec088530ed8d398a8a426bc6e8c0cdcd3 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Mon, 12 Feb 2024 03:10:56 -0500 Subject: [PATCH 1/9] Add IsFileLocal lightup, use it in `CA1708` --- .../IdentifiersShouldDifferByMoreThanCase.cs | 11 ++-- ...ntifiersShouldDifferByMoreThanCaseTests.cs | 53 ++++++++++++++++++- .../Compiler/Analyzer.Utilities.projitems | 1 + .../Compiler/Lightup/IsFileLocalWrapper.cs | 35 ++++++++++++ 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs index 7207c93a46..f68ca41ecb 100644 --- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs +++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; @@ -8,6 +8,7 @@ using Microsoft.CodeAnalysis; using Analyzer.Utilities; using Analyzer.Utilities.Extensions; +using Analyzer.Utilities.Lightup; using Analyzer.Utilities.PooledObjects; namespace Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines @@ -54,7 +55,8 @@ private static void AnalyzeCompilation(CompilationAnalysisContext context) IEnumerable globalTypes = context.Compilation.GlobalNamespace.GetTypeMembers().Where(item => Equals(item.ContainingAssembly, context.Compilation.Assembly) && - MatchesConfiguredVisibility(item, context.Options, context.Compilation)); + MatchesConfiguredVisibility(item, context.Options, context.Compilation) && + !IsFileLocalWrapper.FromSymbol(item).IsFileLocal); CheckTypeNames(globalTypes, context); CheckNamespaceMembers(globalNamespaces, context); @@ -96,8 +98,9 @@ private static void CheckNamespaceMembers(IEnumerable namespac { // Get all the potentially externally visible types in the namespace IEnumerable typeMembers = @namespace.GetTypeMembers().Where(item => - Equals(item.ContainingAssembly, context.Compilation.Assembly) && - MatchesConfiguredVisibility(item, context.Options, context.Compilation)); + Equals(item.ContainingAssembly, context.Compilation.Assembly) && + MatchesConfiguredVisibility(item, context.Options, context.Compilation) && + !IsFileLocalWrapper.FromSymbol(item).IsFileLocal); if (typeMembers.Any()) { diff --git a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs index f9e0cdcc37..0ae23f203c 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Linq; @@ -142,6 +142,57 @@ public partial class F }.RunAsync(); } + [Fact] + public async Task FileScopedTypesInNamespaceAsync() + { + string fileWithClass = """ + namespace N; + + file class C + { + } + """; + + await new VerifyCS.Test + { + TestState = + { + Sources = + { + fileWithClass, + fileWithClass + } + }, + LanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp11, + ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + }.RunAsync(); + } + + [Fact] + public async Task FileScopedTypesGlobalAsync() + { + string fileWithClass = """ + file class C + { + } + """; + + await new VerifyCS.Test + { + TestState = + { + Sources = + { + fileWithClass, + fileWithClass + } + }, + LanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp11, + ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + }.RunAsync(); + } + + #endregion #region Type Level diff --git a/src/Utilities/Compiler/Analyzer.Utilities.projitems b/src/Utilities/Compiler/Analyzer.Utilities.projitems index 441ad25bb5..5b6ac1a284 100644 --- a/src/Utilities/Compiler/Analyzer.Utilities.projitems +++ b/src/Utilities/Compiler/Analyzer.Utilities.projitems @@ -66,6 +66,7 @@ + diff --git a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs new file mode 100644 index 0000000000..0d23b9fa06 --- /dev/null +++ b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +#if HAS_IOPERATION + +namespace Analyzer.Utilities.Lightup +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Reflection; + using Microsoft.CodeAnalysis; + + [SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Not a comparable instance.")] + internal readonly struct IsFileLocalWrapper + { + private static readonly PropertyInfo? PropertyAccessor = typeof(INamedTypeSymbol).GetProperty("IsFileLocal", BindingFlags.Public | BindingFlags.Instance); + + private static readonly Func MemberAccessor = PropertyAccessor is null ? _ => false : symbol => (bool)PropertyAccessor.GetValue(symbol); + + public INamedTypeSymbol WrappedSymbol { get; } + + private IsFileLocalWrapper(INamedTypeSymbol symbol) + { + WrappedSymbol = symbol; + } + + public static IsFileLocalWrapper FromSymbol(INamedTypeSymbol symbol) + { + return new IsFileLocalWrapper(symbol); + } + + public bool IsFileLocal => MemberAccessor(WrappedSymbol); + } +} + +#endif From 801873573f66a14b6a670c546b043b7feb8ce5da Mon Sep 17 00:00:00 2001 From: Michael Render Date: Tue, 13 Feb 2024 00:33:57 -0500 Subject: [PATCH 2/9] Fix nullability --- src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs index 0d23b9fa06..ecf6cc658d 100644 --- a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs +++ b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs @@ -14,7 +14,7 @@ internal readonly struct IsFileLocalWrapper { private static readonly PropertyInfo? PropertyAccessor = typeof(INamedTypeSymbol).GetProperty("IsFileLocal", BindingFlags.Public | BindingFlags.Instance); - private static readonly Func MemberAccessor = PropertyAccessor is null ? _ => false : symbol => (bool)PropertyAccessor.GetValue(symbol); + private static readonly Func MemberAccessor = PropertyAccessor is null ? _ => false : symbol => (bool)PropertyAccessor.GetValue(symbol)!; public INamedTypeSymbol WrappedSymbol { get; } From abd4b92eac9998446a64da0ebdad4a4fef9f6927 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Tue, 13 Feb 2024 00:45:39 -0500 Subject: [PATCH 3/9] Use the style of other lightup types --- src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs index ecf6cc658d..fedb1a9de6 100644 --- a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs +++ b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs @@ -6,15 +6,12 @@ namespace Analyzer.Utilities.Lightup { using System; using System.Diagnostics.CodeAnalysis; - using System.Reflection; using Microsoft.CodeAnalysis; [SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Not a comparable instance.")] internal readonly struct IsFileLocalWrapper { - private static readonly PropertyInfo? PropertyAccessor = typeof(INamedTypeSymbol).GetProperty("IsFileLocal", BindingFlags.Public | BindingFlags.Instance); - - private static readonly Func MemberAccessor = PropertyAccessor is null ? _ => false : symbol => (bool)PropertyAccessor.GetValue(symbol)!; + private static readonly Func PropertyAccessor = LightupHelpers.CreateSymbolPropertyAccessor(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false); public INamedTypeSymbol WrappedSymbol { get; } @@ -28,7 +25,7 @@ public static IsFileLocalWrapper FromSymbol(INamedTypeSymbol symbol) return new IsFileLocalWrapper(symbol); } - public bool IsFileLocal => MemberAccessor(WrappedSymbol); + public bool IsFileLocal => PropertyAccessor(WrappedSymbol); } } From 0266dc5aa801e1d525aa1828e2699486c1288062 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Tue, 13 Feb 2024 00:54:48 -0500 Subject: [PATCH 4/9] Formatting --- .../IdentifiersShouldDifferByMoreThanCaseTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs index 0ae23f203c..563a21e9cb 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs @@ -192,7 +192,6 @@ file class C }.RunAsync(); } - #endregion #region Type Level From 8a8a9e91cc065413ff315bcb8436c71d9dd9a17e Mon Sep 17 00:00:00 2001 From: Michael Render Date: Wed, 14 Feb 2024 17:03:18 -0500 Subject: [PATCH 5/9] PR feedback --- .../IdentifiersShouldDifferByMoreThanCase.cs | 4 ++-- .../Compiler/Lightup/IsFileLocalWrapper.cs | 20 +++---------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs index f68ca41ecb..349054277e 100644 --- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs +++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs @@ -56,7 +56,7 @@ private static void AnalyzeCompilation(CompilationAnalysisContext context) IEnumerable globalTypes = context.Compilation.GlobalNamespace.GetTypeMembers().Where(item => Equals(item.ContainingAssembly, context.Compilation.Assembly) && MatchesConfiguredVisibility(item, context.Options, context.Compilation) && - !IsFileLocalWrapper.FromSymbol(item).IsFileLocal); + !item.IsFileLocal()); CheckTypeNames(globalTypes, context); CheckNamespaceMembers(globalNamespaces, context); @@ -100,7 +100,7 @@ private static void CheckNamespaceMembers(IEnumerable namespac IEnumerable typeMembers = @namespace.GetTypeMembers().Where(item => Equals(item.ContainingAssembly, context.Compilation.Assembly) && MatchesConfiguredVisibility(item, context.Options, context.Compilation) && - !IsFileLocalWrapper.FromSymbol(item).IsFileLocal); + !item.IsFileLocal()); if (typeMembers.Any()) { diff --git a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs index fedb1a9de6..1ed4650412 100644 --- a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs +++ b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs @@ -5,27 +5,13 @@ namespace Analyzer.Utilities.Lightup { using System; - using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis; - [SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Not a comparable instance.")] - internal readonly struct IsFileLocalWrapper + internal static class IsFileLocalWrapper { - private static readonly Func PropertyAccessor = LightupHelpers.CreateSymbolPropertyAccessor(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false); + private static readonly Func s_isFileLocal = LightupHelpers.CreateSymbolPropertyAccessor(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false); - public INamedTypeSymbol WrappedSymbol { get; } - - private IsFileLocalWrapper(INamedTypeSymbol symbol) - { - WrappedSymbol = symbol; - } - - public static IsFileLocalWrapper FromSymbol(INamedTypeSymbol symbol) - { - return new IsFileLocalWrapper(symbol); - } - - public bool IsFileLocal => PropertyAccessor(WrappedSymbol); + public static bool IsFileLocal(this INamedTypeSymbol symbol) => s_isFileLocal(symbol); } } From a0636c9286a70a57f7cc0911ba6ba1756182203b Mon Sep 17 00:00:00 2001 From: Michael Render Date: Wed, 14 Feb 2024 17:04:59 -0500 Subject: [PATCH 6/9] PR feedback --- .../Extensions/INamedTypeSymbolExtensions.cs | 5 +++++ .../Compiler/Lightup/IsFileLocalWrapper.cs | 18 ------------------ 2 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs diff --git a/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs b/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs index 4842a37374..f4f6083f93 100644 --- a/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs +++ b/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using Analyzer.Utilities.Lightup; using Microsoft.CodeAnalysis; namespace Analyzer.Utilities.Extensions @@ -282,5 +283,9 @@ public static bool IsBenchmarkOrXUnitTestAttribute(this INamedTypeSymbol attribu public static bool IsTopLevelStatementsEntryPointType([NotNullWhen(true)] this INamedTypeSymbol? typeSymbol) => typeSymbol is not null && typeSymbol.GetMembers().OfType().Any(m => m.IsTopLevelStatementsEntryPointMethod()); + + private static readonly Func s_isFileLocal = LightupHelpers.CreateSymbolPropertyAccessor(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false); + + public static bool IsFileLocal(this INamedTypeSymbol symbol) => s_isFileLocal(symbol); } } diff --git a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs b/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs deleted file mode 100644 index 1ed4650412..0000000000 --- a/src/Utilities/Compiler/Lightup/IsFileLocalWrapper.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -#if HAS_IOPERATION - -namespace Analyzer.Utilities.Lightup -{ - using System; - using Microsoft.CodeAnalysis; - - internal static class IsFileLocalWrapper - { - private static readonly Func s_isFileLocal = LightupHelpers.CreateSymbolPropertyAccessor(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false); - - public static bool IsFileLocal(this INamedTypeSymbol symbol) => s_isFileLocal(symbol); - } -} - -#endif From 5339702235f722fd24ce41ac1b3331be5fff2317 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Wed, 14 Feb 2024 17:05:26 -0500 Subject: [PATCH 7/9] Cleanup --- .../ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs | 1 - src/Utilities/Compiler/Analyzer.Utilities.projitems | 1 - 2 files changed, 2 deletions(-) diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs index 349054277e..9a1e40be72 100644 --- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs +++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs @@ -8,7 +8,6 @@ using Microsoft.CodeAnalysis; using Analyzer.Utilities; using Analyzer.Utilities.Extensions; -using Analyzer.Utilities.Lightup; using Analyzer.Utilities.PooledObjects; namespace Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines diff --git a/src/Utilities/Compiler/Analyzer.Utilities.projitems b/src/Utilities/Compiler/Analyzer.Utilities.projitems index 5b6ac1a284..441ad25bb5 100644 --- a/src/Utilities/Compiler/Analyzer.Utilities.projitems +++ b/src/Utilities/Compiler/Analyzer.Utilities.projitems @@ -66,7 +66,6 @@ - From 8d53933380d3cc217ca15c575b0821a9848e3311 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Wed, 14 Feb 2024 17:12:22 -0500 Subject: [PATCH 8/9] Further PR feedback --- .../IdentifiersShouldDifferByMoreThanCase.cs | 6 +++--- .../Compiler/Extensions/INamedTypeSymbolExtensions.cs | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs index 9a1e40be72..887585aab9 100644 --- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs +++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCase.cs @@ -97,9 +97,9 @@ private static void CheckNamespaceMembers(IEnumerable namespac { // Get all the potentially externally visible types in the namespace IEnumerable typeMembers = @namespace.GetTypeMembers().Where(item => - Equals(item.ContainingAssembly, context.Compilation.Assembly) && - MatchesConfiguredVisibility(item, context.Options, context.Compilation) && - !item.IsFileLocal()); + Equals(item.ContainingAssembly, context.Compilation.Assembly) && + MatchesConfiguredVisibility(item, context.Options, context.Compilation) && + !item.IsFileLocal()); if (typeMembers.Any()) { diff --git a/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs b/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs index f4f6083f93..9c395554d9 100644 --- a/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs +++ b/src/Utilities/Compiler/Extensions/INamedTypeSymbolExtensions.cs @@ -14,6 +14,11 @@ namespace Analyzer.Utilities.Extensions { internal static class INamedTypeSymbolExtensions { + + private static readonly Func s_isFileLocal = LightupHelpers.CreateSymbolPropertyAccessor(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false); + + public static bool IsFileLocal(this INamedTypeSymbol symbol) => s_isFileLocal(symbol); + public static IEnumerable GetBaseTypesAndThis(this INamedTypeSymbol type) { INamedTypeSymbol current = type; @@ -283,9 +288,5 @@ public static bool IsBenchmarkOrXUnitTestAttribute(this INamedTypeSymbol attribu public static bool IsTopLevelStatementsEntryPointType([NotNullWhen(true)] this INamedTypeSymbol? typeSymbol) => typeSymbol is not null && typeSymbol.GetMembers().OfType().Any(m => m.IsTopLevelStatementsEntryPointMethod()); - - private static readonly Func s_isFileLocal = LightupHelpers.CreateSymbolPropertyAccessor(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false); - - public static bool IsFileLocal(this INamedTypeSymbol symbol) => s_isFileLocal(symbol); } } From 3b2dccd57e819b5e60d136c70b65323db5b8cac0 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Wed, 14 Feb 2024 17:26:42 -0500 Subject: [PATCH 9/9] Add [WorkItem] attribute --- .../IdentifiersShouldDifferByMoreThanCaseTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs index 563a21e9cb..5da69d2d9e 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldDifferByMoreThanCaseTests.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Testing; +using Test.Utilities; using Xunit; using VerifyCS = Test.Utilities.CSharpCodeFixVerifier< Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.IdentifiersShouldDifferByMoreThanCaseAnalyzer, @@ -142,7 +143,7 @@ public partial class F }.RunAsync(); } - [Fact] + [Fact, WorkItem(6514, "https://github.com/dotnet/roslyn-analyzers/issues/6514")] public async Task FileScopedTypesInNamespaceAsync() { string fileWithClass = """ @@ -168,7 +169,7 @@ file class C }.RunAsync(); } - [Fact] + [Fact, WorkItem(6514, "https://github.com/dotnet/roslyn-analyzers/issues/6514")] public async Task FileScopedTypesGlobalAsync() { string fileWithClass = """