diff --git a/.editorconfig b/.editorconfig index 894dbbb52f..6ae0879c08 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,9 +13,6 @@ dotnet_diagnostic.VSTHRD103.severity = none # VSTHRD200: Use "Async" suffix for async methods dotnet_diagnostic.VSTHRD200.severity = none -# RS1024: Compare symbols correctly -dotnet_diagnostic.RS1024.severity = none - # RS1025: Configure generated code analysis dotnet_diagnostic.RS1025.severity = none diff --git a/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendAnalyzer.cs b/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendAnalyzer.cs index 87f0d7c148..573eeb778b 100644 --- a/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendAnalyzer.cs +++ b/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendAnalyzer.cs @@ -74,7 +74,7 @@ private void AnalyzeCore(SemanticModelAnalysisContext context, string attributeN if (symbol == null) continue; var symbolAssembly = symbol.ContainingAssembly; - if (symbolAssembly == myAssembly) + if (Equals(symbolAssembly, myAssembly)) continue; switch (symbol.DeclaredAccessibility) { @@ -92,12 +92,12 @@ private void AnalyzeCore(SemanticModelAnalysisContext context, string attributeN // It's the first of seeing the assembly containing symbol. A key-value pair is added into assemblyHasAttrMap to // indicate if that assembly includes an attribute WantsToBeBestFriends. If an assembly has WantsToBeBestFriends then // its associated value would be true. - assemblyWantsBestFriends = symbolAssembly.GetAttributes().Any(a => a.AttributeClass == wantsToBeBestFriendsAttributeType); + assemblyWantsBestFriends = symbolAssembly.GetAttributes().Any(a => Equals(a.AttributeClass, wantsToBeBestFriendsAttributeType)); assemblyHasAttrMap[symbolAssembly] = assemblyWantsBestFriends; } if (!assemblyWantsBestFriends) continue; - if (symbol.GetAttributes().Any(a => a.AttributeClass == bestFriendAttributeType)) + if (symbol.GetAttributes().Any(a => Equals(a.AttributeClass, bestFriendAttributeType))) { // You're not just a friend, you're my best friend! continue; diff --git a/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendOnPublicDeclarationsAnalyzer.cs b/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendOnPublicDeclarationsAnalyzer.cs index 658e957c16..75b6545f3d 100644 --- a/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendOnPublicDeclarationsAnalyzer.cs +++ b/tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendOnPublicDeclarationsAnalyzer.cs @@ -59,7 +59,7 @@ private void AnalyzeCore(SymbolAnalysisContext context, INamedTypeSymbol attribu if (context.Symbol.DeclaredAccessibility != Accessibility.Public) return; - var attribute = context.Symbol.GetAttributes().FirstOrDefault(a => a.AttributeClass == attributeType); + var attribute = context.Symbol.GetAttributes().FirstOrDefault(a => Equals(a.AttributeClass, attributeType)); if (attribute == null) return;