-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Obsolete some protected members of Regex{Runner} #62573
Copy link
Copy link
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.RegularExpressionsbreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.Issue or PR that represents a breaking API or functional change over a previous release.needs-breaking-change-doc-createdBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnetBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet
Milestone
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.RegularExpressionsbreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.Issue or PR that represents a breaking API or functional change over a previous release.needs-breaking-change-doc-createdBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnetBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet
Type
Fields
Give feedbackNo fields configured for issues without a type.
Regex and RegexRunner have a relatively large protected surface area in support of the old CompileToAssembly, which is now obsolete. Some of that functionality is used by code generated by the source generator, but some of the surface area is completely defunct, and some was never used (who knows why it was exposed initially).
namespace System.Text.RegularExpressions; public class Regex { + [Obsolete(...)] protected void InitializeReferences(); + [Obsolete(...)] protected bool UseOptionC() + [Obsolete(...)] protected bool UseOptionR(); } public abstract class RegexRunner { + [Obsolete(...)] protected Match? Scan(Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick) => Scan(regex, text, textbeg, textend, textstart, prevlen, quick, regex.MatchTimeout); + [Obsolete(...)] protected internal Match? Scan(Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick, TimeSpan timeout) + [Obsolete(...)] protected static bool CharInSet(char ch, string set, string category); }I would like to also make that last
CharInSetnot only obsolete but alsothrow new NotSupportedException(). This was never used by the implementation, and we've never generated assets that use whatever format it's trying to support.