| __`SYSLIB0049`__ | JsonSerializerOptions.AddContext is obsolete. To register a JsonSerializerContext, use either the TypeInfoResolver or TypeInfoResolverChain properties. |
| __`SYSLIB0050`__ | Formatter-based serialization is obsolete and should not be used. |
| __`SYSLIB0051`__ | This API supports obsolete formatter-based serialization. It should not be called or extended by application code. |
+| __`SYSLIB0052`__ | This API supports obsolete mechanisms for Regex extensibility. It is not supported. |
## Analyzer Warnings
internal const string LegacyFormatterImplMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code.";
internal const string LegacyFormatterImplDiagId = "SYSLIB0051";
+
+ internal const string RegexExtensibilityImplMessage = "This API supports obsolete mechanisms for Regex extensibility. It is not supported.";
+ internal const string RegexExtensibilityDiagId = "SYSLIB0052";
}
}
public int[] GetGroupNumbers() { throw null; }
public string GroupNameFromNumber(int i) { throw null; }
public int GroupNumberFromName(string name) { throw null; }
+ [System.ObsoleteAttribute("This API supports obsolete mechanisms for Regex extensibility. It is not supported.", DiagnosticId = "SYSLIB0052", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
protected void InitializeReferences() { }
public bool IsMatch(System.ReadOnlySpan<char> input) { throw null; }
public bool IsMatch(System.ReadOnlySpan<char> input, int startat) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
public static string Unescape(string str) { throw null; }
+ [System.ObsoleteAttribute("This API supports obsolete mechanisms for Regex extensibility. It is not supported.", DiagnosticId = "SYSLIB0052", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
protected bool UseOptionC() { throw null; }
- protected internal bool UseOptionR() { throw null; }
+ [System.ObsoleteAttribute("This API supports obsolete mechanisms for Regex extensibility. It is not supported.", DiagnosticId = "SYSLIB0052", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ protected bool UseOptionR() { throw null; }
protected internal static void ValidateMatchTimeout(System.TimeSpan matchTimeout) { }
public ref partial struct ValueMatchEnumerator
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public abstract partial class RegexRunner
{
protected internal int[]? runcrawl;
protected internal RegexRunner() { }
protected void Capture(int capnum, int start, int end) { }
public static bool CharInClass(char ch, string charClass) { throw null; }
+ [System.ObsoleteAttribute("This API supports obsolete mechanisms for Regex extensibility. It is not supported.", DiagnosticId = "SYSLIB0052", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
protected static bool CharInSet(char ch, string @set, string category) { throw null; }
protected void CheckTimeout() { }
protected void Crawl(int i) { }
protected int MatchIndex(int cap) { throw null; }
protected int MatchLength(int cap) { throw null; }
protected int Popcrawl() { throw null; }
+ [System.ObsoleteAttribute("This API supports obsolete mechanisms for Regex extensibility. It is not supported.", DiagnosticId = "SYSLIB0052", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
protected internal System.Text.RegularExpressions.Match? Scan(System.Text.RegularExpressions.Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick) { throw null; }
+ [System.ObsoleteAttribute("This API supports obsolete mechanisms for Regex extensibility. It is not supported.", DiagnosticId = "SYSLIB0052", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
protected internal System.Text.RegularExpressions.Match? Scan(System.Text.RegularExpressions.Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick, System.TimeSpan timeout) { throw null; }
protected internal virtual void Scan(System.ReadOnlySpan<char> text) { throw null; }
protected void TransferCapture(int capnum, int uncapnum, int start, int end) { }
protected void Uncapture() { }
}
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public abstract partial class RegexRunnerFactory
{
protected RegexRunnerFactory() { }
Interlocked.CompareExchange(ref _replref, new WeakReference<RegexReplacement?>(null), null) ??
_replref;
+ [Obsolete(Obsoletions.RegexExtensibilityImplMessage, DiagnosticId = Obsoletions.RegexExtensibilityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected void InitializeReferences()
{
// This method no longer has anything to initialize. It continues to exist
factory!.CreateInstance();
/// <summary>True if the <see cref="RegexOptions.Compiled"/> option was set.</summary>
+ [Obsolete(Obsoletions.RegexExtensibilityImplMessage, DiagnosticId = Obsoletions.RegexExtensibilityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected bool UseOptionC() => (roptions & RegexOptions.Compiled) != 0;
/// <summary>True if the <see cref="RegexOptions.RightToLeft"/> option was set.</summary>
- protected internal bool UseOptionR() => RightToLeft;
+ [Obsolete(Obsoletions.RegexExtensibilityImplMessage, DiagnosticId = Obsoletions.RegexExtensibilityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected bool UseOptionR() => RightToLeft;
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-// This RegexRunner class is a base class for compiled regex code.
+// This RegexRunner class is a base class for source-generated regex extensibility
+// (and the old CompileToAssembly extensibility). It's not intended to be used
+// by anything else.
// Implementation notes:
-// It provides the driver code that call's the subclass's Go()
+// It provides the driver code that call's the subclass's Scan
// method for either scanning or direct execution.
-//
// It also maintains memory allocation for the backtracking stack,
// the grouping stack and the longjump crawlstack, and provides
// methods to push new subpattern match results into (or remove
// backtracked results from) the Match instance.
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
+using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace System.Text.RegularExpressions
{
+ [EditorBrowsable(EditorBrowsableState.Never)]
public abstract class RegexRunner
{
protected internal int runtextbeg; // Beginning of text to search. We now always use a sliced span of the input
InternalScan(runregex!, beginning, beginning + text.Length);
}
- // TODO https://github.com/dotnet/runtime/issues/62573: Obsolete this.
+ [Obsolete(Obsoletions.RegexExtensibilityImplMessage, DiagnosticId = Obsoletions.RegexExtensibilityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
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);
- // TODO https://github.com/dotnet/runtime/issues/62573: Obsolete this.
/// <summary>
/// This method's body is only kept since it is a protected member that could be called by someone outside
/// the assembly.
/// </summary>
+ [Obsolete(Obsoletions.RegexExtensibilityImplMessage, DiagnosticId = Obsoletions.RegexExtensibilityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
protected internal Match? Scan(Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick, TimeSpan timeout)
{
InitializeTimeout(timeout);
((uint)index < (uint)inputSpan.Length && RegexCharClass.IsECMAWordChar(inputSpan[index]));
}
+ [Obsolete(Obsoletions.RegexExtensibilityImplMessage, DiagnosticId = Obsoletions.RegexExtensibilityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
protected static bool CharInSet(char ch, string set, string category)
{
string charClass = RegexCharClass.ConvertOldStringsToClass(set, category);
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.ComponentModel;
+
namespace System.Text.RegularExpressions
{
+ [EditorBrowsable(EditorBrowsableState.Never)]
public abstract class RegexRunnerFactory
{
protected RegexRunnerFactory() { }
internal class CustomRegexRunner : RegexRunner
{
public Match? CallScanDirectly(Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick)
+#pragma warning disable SYSLIB0052 // Type or member is obsolete
=> Scan(regex, text, textbeg, textend, textstart, prevlen, quick);
+#pragma warning restore SYSLIB0052 // Type or member is obsolete
protected override void InitTrackCount() => base.runtrackcount = 12;
capslist[1] = "1";
capslist[2] = "output";
capsize = 3;
+#pragma warning disable SYSLIB0052 // Type or member is obsolete
base.InitializeReferences();
+#pragma warning restore SYSLIB0052 // Type or member is obsolete
}
public RegexTestClass(TimeSpan timeSpan) : this()
public DerivedRegex() { }
public DerivedRegex(string pattern) : base(pattern) { }
+#pragma warning disable SYSLIB0052 // Type or member is obsolete
public new void InitializeReferences() => base.InitializeReferences();
+#pragma warning restore SYSLIB0052 // Type or member is obsolete
public new IDictionary Caps { get => base.Caps; set => base.Caps = value; }
public new IDictionary CapNames { get => base.CapNames; set => base.CapNames = value; }
public new bool IsBoundary(int index, int startpos, int endpos) => base.IsBoundary(index, startpos, endpos);
+#pragma warning disable SYSLIB0052 // Type or member is obsolete
public static new bool CharInSet(char ch, string set, string category) => RegexRunner.CharInSet(ch, set, category);
+#pragma warning restore SYSLIB0052 // Type or member is obsolete
protected override bool FindFirstChar() => throw new NotImplementedException();
protected override void Go() => throw new NotImplementedException();