Skip to content

Commit 826e86a

Browse files
CR Feedback: Add back bool to track whether attribute property matched
1 parent 68573f2 commit 826e86a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/DefaultTagHelperDescriptorFactory.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System;
@@ -249,6 +249,7 @@ private static void ConfigureDictionaryBoundAttribute(
249249
bool hasPublicSetter)
250250
{
251251
string? dictionaryAttributePrefix = null;
252+
var dictionaryAttributePrefixSet = false;
252253

253254
if (attributeNameAttribute != null)
254255
{
@@ -257,6 +258,7 @@ private static void ConfigureDictionaryBoundAttribute(
257258
if (name == TagHelperTypes.HtmlAttributeName.DictionaryAttributePrefix)
258259
{
259260
dictionaryAttributePrefix = (string?)argument.Value;
261+
dictionaryAttributePrefixSet = true;
260262
break;
261263
}
262264
}
@@ -266,7 +268,7 @@ private static void ConfigureDictionaryBoundAttribute(
266268

267269
if (!dictionaryTypeArguments.IsEmpty)
268270
{
269-
var prefix = attributeNameAttribute is null || dictionaryAttributePrefix is null
271+
var prefix = attributeNameAttribute is null || !dictionaryAttributePrefixSet
270272
? attributeName + "-"
271273
: dictionaryAttributePrefix;
272274

@@ -291,7 +293,7 @@ private static void ConfigureDictionaryBoundAttribute(
291293
return;
292294
}
293295

294-
if (!hasPublicSetter && attributeNameAttribute != null && dictionaryAttributePrefix == null)
296+
if (!hasPublicSetter && attributeNameAttribute != null && !dictionaryAttributePrefixSet)
295297
{
296298
// Must set DictionaryAttributePrefix when using HtmlAttributeNameAttribute with a dictionary property
297299
// that lacks a public setter.

0 commit comments

Comments
 (0)