diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs index 06b5bed18f..795786f5b8 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTagHelperDescriptorFactory.cs @@ -110,11 +110,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) { // Will invoke asynchronously. Method must not return Task or Task. - if (Equals(returnType, _taskSymbol)) + if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { // This is ok. } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { // This is ok. } @@ -134,13 +134,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X method = null; return false; } - else if (Equals(returnType, _taskSymbol)) + else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; return false; } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; @@ -208,13 +208,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X private string GetIndexerValueTypeName(IParameterSymbol parameter) { INamedTypeSymbol dictionaryType; - if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)parameter.Type; } - else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -234,7 +234,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X private string GetShortName(INamedTypeSymbol componentType) { - var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); + var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); var name = viewComponentAttribute ?.NamedArguments .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs index 916bc60653..450e4e1557 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/src/ViewComponentTypeVisitor.cs @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X return false; } - var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); + var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); if (attribute != null) { diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs index 75b4cd62be..ef989c3f7f 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTagHelperDescriptorFactory.cs @@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) { // Will invoke asynchronously. Method must not return Task or Task. - if (Equals(returnType, _taskSymbol)) + if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { // This is ok. } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { // This is ok. } @@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X method = null; return false; } - else if (Equals(returnType, _taskSymbol)) + else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; return false; } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; @@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X private string GetIndexerValueTypeName(IParameterSymbol parameter) { INamedTypeSymbol dictionaryType; - if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)parameter.Type; } - else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X private string GetShortName(INamedTypeSymbol componentType) { - var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); + var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); var name = viewComponentAttribute ?.NamedArguments .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs index 0281880866..1d7463884c 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/src/ViewComponentTypeVisitor.cs @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X return false; } - var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); + var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); if (attribute != null) { diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs index aaa765fb63..c266d7541d 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTagHelperDescriptorFactory.cs @@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal)) { // Will invoke asynchronously. Method must not return Task or Task. - if (Equals(returnType, _taskSymbol)) + if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { // This is ok. } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { // This is ok. } @@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions method = null; return false; } - else if (Equals(returnType, _taskSymbol)) + else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; return false; } - else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol)) + else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol)) { diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat)); method = null; @@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions private string GetIndexerValueTypeName(IParameterSymbol parameter) { INamedTypeSymbol dictionaryType; - if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)parameter.Type; } - else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions private string GetShortName(INamedTypeSymbol componentType) { - var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); + var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault(); var name = viewComponentAttribute ?.NamedArguments .Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal)) diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs index 498b28fdc2..8c7a3b4065 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/ViewComponentTypeVisitor.cs @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions return false; } - var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); + var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault(); if (attribute != null) { diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs index e21332c150..05dea796a6 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs @@ -235,7 +235,7 @@ namespace Microsoft.CodeAnalysis.Razor // We need to check the constructor argument length here, because this can show up as 0 // if the language service fails to initialize. This is an invalid case, so skip it. - if (Equals(attribute.AttributeClass, bindElement) && attribute.ConstructorArguments.Length == 4) + if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindElement) && attribute.ConstructorArguments.Length == 4) { results.Add(new ElementBindData( type.ContainingAssembly.Name, @@ -246,7 +246,7 @@ namespace Microsoft.CodeAnalysis.Razor (string)attribute.ConstructorArguments[2].Value, (string)attribute.ConstructorArguments[3].Value)); } - else if (Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 4) + else if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 4) { results.Add(new ElementBindData( type.ContainingAssembly.Name, @@ -257,7 +257,7 @@ namespace Microsoft.CodeAnalysis.Razor (string)attribute.ConstructorArguments[2].Value, (string)attribute.ConstructorArguments[3].Value)); } - else if (Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 6) + else if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 6) { results.Add(new ElementBindData( type.ContainingAssembly.Name, diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs index 75569b2b3c..38fbfb6ba8 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/ComponentTagHelperDescriptorProvider.cs @@ -328,7 +328,7 @@ namespace Microsoft.CodeAnalysis.Razor var properties = new Dictionary(StringComparer.Ordinal); do { - if (Equals(type, symbols.ComponentBase)) + if (SymbolEqualityComparer.Default.Equals(type, symbols.ComponentBase)) { // The ComponentBase base class doesn't have any [Parameter]. // Bail out now to avoid walking through its many members, plus the members @@ -381,7 +381,7 @@ namespace Microsoft.CodeAnalysis.Razor kind = PropertyKind.Ignored; } - if (!property.GetAttributes().Any(a => Equals(a.AttributeClass, symbols.ParameterAttribute))) + if (!property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute))) { if (property.IsOverride) { @@ -399,7 +399,7 @@ namespace Microsoft.CodeAnalysis.Razor kind = PropertyKind.Enum; } - if (kind == PropertyKind.Default && Equals(property.Type, symbols.RenderFragment)) + if (kind == PropertyKind.Default && SymbolEqualityComparer.Default.Equals(property.Type, symbols.RenderFragment)) { kind = PropertyKind.ChildContent; } @@ -407,12 +407,12 @@ namespace Microsoft.CodeAnalysis.Razor if (kind == PropertyKind.Default && property.Type is INamedTypeSymbol namedType && namedType.IsGenericType && - Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT)) + SymbolEqualityComparer.Default.Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT)) { kind = PropertyKind.ChildContent; } - if (kind == PropertyKind.Default && Equals(property.Type, symbols.EventCallback)) + if (kind == PropertyKind.Default && SymbolEqualityComparer.Default.Equals(property.Type, symbols.EventCallback)) { kind = PropertyKind.EventCallback; } @@ -420,7 +420,7 @@ namespace Microsoft.CodeAnalysis.Razor if (kind == PropertyKind.Default && property.Type is INamedTypeSymbol namedType2 && namedType2.IsGenericType && - Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT)) + SymbolEqualityComparer.Default.Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT)) { kind = PropertyKind.EventCallback; } diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs index 17924a0018..4eb83b36b7 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/DefaultTagHelperDescriptorFactory.cs @@ -80,7 +80,7 @@ namespace Microsoft.CodeAnalysis.Razor { var targetElementAttributes = type .GetAttributes() - .Where(attribute => Equals(attribute.AttributeClass, _htmlTargetElementAttributeSymbol)); + .Where(attribute => SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, _htmlTargetElementAttributeSymbol)); // If there isn't an attribute specifying the tag name derive it from the name if (!targetElementAttributes.Any()) @@ -139,7 +139,7 @@ namespace Microsoft.CodeAnalysis.Razor private void AddAllowedChildren(INamedTypeSymbol type, TagHelperDescriptorBuilder builder) { - var restrictChildrenAttribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, _restrictChildrenAttributeSymbol)).FirstOrDefault(); + var restrictChildrenAttribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _restrictChildrenAttributeSymbol)).FirstOrDefault(); if (restrictChildrenAttribute == null) { return; @@ -174,7 +174,7 @@ namespace Microsoft.CodeAnalysis.Razor private void AddTagOutputHint(INamedTypeSymbol type, TagHelperDescriptorBuilder builder) { string outputElementHint = null; - var outputElementHintAttribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, _outputElementHintAttributeSymbol)).FirstOrDefault(); + var outputElementHintAttribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _outputElementHintAttributeSymbol)).FirstOrDefault(); if (outputElementHintAttribute != null) { outputElementHint = (string)(outputElementHintAttribute.ConstructorArguments[0]).Value; @@ -189,7 +189,7 @@ namespace Microsoft.CodeAnalysis.Razor { var attributeNameAttribute = property .GetAttributes() - .Where(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) + .Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) .FirstOrDefault(); bool hasExplicitName; @@ -310,13 +310,13 @@ namespace Microsoft.CodeAnalysis.Razor private IReadOnlyList GetDictionaryArgumentTypes(IPropertySymbol property) { INamedTypeSymbol dictionaryType; - if (Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) + if (SymbolEqualityComparer.Default.Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol)) { dictionaryType = (INamedTypeSymbol)property.Type; } - else if (property.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) + else if (property.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) { - dictionaryType = property.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol)); + dictionaryType = property.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)); } else { @@ -380,7 +380,7 @@ namespace Microsoft.CodeAnalysis.Razor private bool IsPotentialDictionaryProperty(IPropertySymbol property) { return - (Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol) || property.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) && + (SymbolEqualityComparer.Default.Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol) || property.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) && GetDictionaryArgumentTypes(property)?[0].SpecialType == SpecialType.System_String; } @@ -397,8 +397,8 @@ namespace Microsoft.CodeAnalysis.Razor property.Parameters.Length == 0 && property.GetMethod != null && property.GetMethod.DeclaredAccessibility == Accessibility.Public && - property.GetAttributes().Where(a => Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null && - (property.GetAttributes().Any(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) || + property.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null && + (property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) || property.SetMethod != null && property.SetMethod.DeclaredAccessibility == Accessibility.Public || IsPotentialDictionaryProperty(property)) && !accessibleProperties.ContainsKey(property.Name)) @@ -418,7 +418,7 @@ namespace Microsoft.CodeAnalysis.Razor { if (ExcludeHidden) { - var editorBrowsableAttribute = symbol.GetAttributes().Where(a => Equals(a.AttributeClass, _editorBrowsableAttributeSymbol)).FirstOrDefault(); + var editorBrowsableAttribute = symbol.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _editorBrowsableAttributeSymbol)).FirstOrDefault(); if (editorBrowsableAttribute == null) { diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs index 5522b50163..9f5cf0d20a 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/EventHandlerTagHelperDescriptorProvider.cs @@ -81,7 +81,7 @@ namespace Microsoft.CodeAnalysis.Razor { var attribute = attributes[j]; - if (Equals(attribute.AttributeClass, eventHandlerAttribute)) + if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, eventHandlerAttribute)) { var enablePreventDefault = false; var enableStopPropagation = false;