From c87dd8d9de3eebd05e14745bf340b04f0fd7c181 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 23 Jul 2015 15:26:46 -0700 Subject: [PATCH] Fix EditorBrowsableAttribute detection to apply to individual attributes. - Prior to this change we'd return early and not generate any found descriptors if ANY property on a `TagHelper` had editor browsable never. - This issue was hidden from tests due to us using the wrong comparer. Updated the comparer and failures occurred without the `TagHelperDescriptorFactory` change (yay). #454 --- .../TagHelpers/TagHelperDescriptorFactory.cs | 2 +- .../TagHelpers/TagHelperDescriptorFactoryTest.cs | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs index 1c0c187eef..4f97df03f1 100644 --- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs +++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs @@ -273,7 +273,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers { if (ShouldSkipDescriptorCreation(designTime, property)) { - return Enumerable.Empty(); + continue; } var attributeNameAttribute = property.GetCustomAttribute(inherit: false); diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs index e34223600a..8b0c68c8e2 100644 --- a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs +++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs @@ -185,18 +185,19 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers assemblyName: AssemblyName, attributes: new[] { + new TagHelperAttributeDescriptor( + name: "property2", + propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property2), + typeName: typeof(int).FullName, + isIndexer: false, + designTimeDescriptor: null), new TagHelperAttributeDescriptor( name: "property", propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property), typeName: typeof(int).FullName, isIndexer: false, designTimeDescriptor: null), - new TagHelperAttributeDescriptor( - name: "property2", - propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property2), - typeName: typeof(int).FullName, - isIndexer: false, - designTimeDescriptor: null) + }) } }, @@ -244,7 +245,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers // Assert Assert.Empty(errorSink.Errors); - Assert.Equal(expectedDescriptors, descriptors, TagHelperDescriptorComparer.Default); + Assert.Equal(expectedDescriptors, descriptors, CaseSensitiveTagHelperDescriptorComparer.Default); } public static TheoryData AttributeTargetData