From f7428b93383883ca53642c823ebe0019df503927 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 20 Jan 2022 13:56:08 -0500 Subject: [PATCH] Add StringSyntax attribute to Regex.pattern field I missed adding this one in my initial audit. It'll be exceedingly rare for a developer to manually write code that assigns a string to this protected field, but every source-generated regex does so, and thus any colorization VS provides will benefit looking at the source-generated code. --- .../src/System/Text/RegularExpressions/Regex.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs index f34cc2329d291b..08793ce85ca68c 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs @@ -22,6 +22,7 @@ public partial class Regex : ISerializable { internal const int MaxOptionShift = 11; + [StringSyntax(StringSyntaxAttribute.Regex)] protected internal string? pattern; // The string pattern provided protected internal RegexOptions roptions; // the top-level options from the options string protected internal RegexRunnerFactory? factory; // Factory used to create runner instances for executing the regex