Backport System.Text.RegularExpressions XML docs from dotnet-api-docs to source#127038
Merged
danmoseley merged 4 commits intodotnet:mainfrom Apr 17, 2026
Merged
Backport System.Text.RegularExpressions XML docs from dotnet-api-docs to source#127038danmoseley merged 4 commits intodotnet:mainfrom
danmoseley merged 4 commits intodotnet:mainfrom
Conversation
… to source Backport API documentation from dotnet/dotnet-api-docs into /// XML doc comments in source, making source the single source of truth for System.Text.RegularExpressions IntelliSense and API documentation. This is part of the broader effort tracked in dotnet/dotnet-api-docs#10722 to migrate API docs into source code. Changes: - Remove UseCompilerGeneratedDocXmlFile=false from csproj, so compiler-generated XML becomes authoritative for IntelliSense - Backport docs-repo content for all public types: Regex (all partials), Capture, Group, Match, CaptureCollection, GroupCollection, MatchCollection, RegexOptions, RegexCompilationInfo, RegexMatchTimeoutException, RegexParseError, RegexParseException, GeneratedRegexAttribute, ValueMatch, and delegates - Add minimal docs for EditorBrowsable(Never) infrastructure types (RegexRunner, RegexRunnerFactory) to satisfy CS1591 - Convert docs-repo markdown/CDATA format to standard XML doc comments (<remarks>, <para>, <c>, <see>, <list>, etc.) - Keep source-only content where docs-repo was missing (e.g. AnyNewLine, NonBacktracking) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions |
Contributor
There was a problem hiding this comment.
Pull request overview
Backports richer XML documentation for System.Text.RegularExpressions APIs into source /// comments so IntelliSense and generated docs can be sourced from the runtime repo.
Changes:
- Expanded/standardized XML doc comments across
System.Text.RegularExpressionspublic surface area (types, members, exceptions, remarks). - Added XML docs for previously undocumented/protected members to avoid doc warnings (e.g., protected fields / constructors).
- Updated project configuration by removing
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>so compiler-generated XML becomes authoritative.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/ValueMatch.cs | Refined XML docs for ValueMatch and its members. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexRunnerFactory.cs | Added XML docs for extensibility factory type/members. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexRunner.cs | Added/converted XML docs for runner APIs and helpers. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParseException.cs | Improved exception XML docs for parsing failures. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParseError.cs | Fixed/standardized enum value docs formatting. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexOptions.cs | Added comprehensive option/member docs with links/remarks. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchTimeoutException.cs | Expanded exception docs incl. constructors/serialization/properties. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs | Added docs clarifying obsolescence / source generator guidance. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs | Added class/field/ctor/member docs and richer remarks. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Timeout.cs | Expanded time-out related docs and remarks. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Split.cs | Expanded XML docs for Split overloads. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Replace.cs | Expanded XML docs for Replace overloads and MatchEvaluator. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Match.cs | Expanded XML docs for IsMatch/Match/Matches overloads. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.EnumerateSplits.cs | Adjusted XML docs for split enumerator APIs. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.EnumerateMatches.cs | Expanded XML docs for match enumerator APIs. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Cache.cs | Added docs for Regex.CacheSize and cache behavior. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/MatchCollection.cs | Expanded collection docs (lazy vs direct eval, members, exceptions). |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Match.cs | Replaced internal block comments with public-facing XML docs. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/GroupCollection.cs | Expanded group collection docs and member documentation. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Group.cs | Added richer docs for group semantics and captures. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/GeneratedRegexAttribute.cs | Reflowed/standardized attribute docs and remarks. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CaptureCollection.cs | Expanded capture collection docs and member documentation. |
| src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Capture.cs | Expanded capture docs (properties/remarks/ToString). |
| src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj | Removed explicit opt-out of compiler-generated XML doc output. |
Copilot's findings
Comments suppressed due to low confidence (4)
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Split.cs:72
- In XML docs,
<see cref="Regex"/>.Splitwon’t link to the Split methods. Consider using<see cref="Regex.Split(string)"/>(or an appropriate overload) instead of linking only to the type.
/// The <see cref="Regex"/>.Split methods are similar to the
/// <see cref="string.Split(char[])"/> method, except that <see cref="Regex"/>.Split splits
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Split.cs:125
- In XML docs,
<see cref="Regex"/>.Splitdoesn’t produce a method link. Prefer a<see cref="..."/>that targets the relevant Split overload (e.g.<see cref="Regex.Split(string)"/>) so IntelliSense links correctly.
/// The <see cref="Regex"/>.Split methods are similar to the
/// <see cref="string.Split(char[])"/> method, except that <see cref="Regex"/>.Split splits
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Split.cs:163
- These remarks use
<see cref="Regex"/>.Split, which links only to the Regex type, not the Split methods. Consider switching to a specific overload like<see cref="Regex.Split(string)"/>and then referring to “this method” in text.
/// The <see cref="Regex"/>.Split methods are similar to the
/// <see cref="string.Split(char[])"/> method, except that <see cref="Regex"/>.Split splits
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Split.cs:206
<see cref="Regex"/>.Splitwon’t resolve as a method link in generated docs/IntelliSense. Prefer<see cref="Regex.Split(string, int)"/>(or whatever overload is being discussed) and tweak the prose to match.
/// The <see cref="Regex"/>.Split methods are similar to
/// <see cref="string.Split(char[])"/>. The <paramref name="count"/> parameter specifies
- Files reviewed: 24/24 changed files
- Comments generated: 4
- MatchCollection.CopyTo: fix exception docs to match List<T>.CopyTo behavior (ArgumentOutOfRangeException for bad index, ArgumentException for multi-dim/space) - CaptureCollection.CopyTo: fix to IndexOutOfRangeException (Array.SetValue behavior), add ArgumentException for multidimensional arrays - Regex.CacheSize: change 'compiled regular expressions' to 'regular expression instances' since the cache stores all static Regex instances, not just Compiled ones - Regex.Split: fix <see cref="Regex"/>.Split to <see cref="Regex.Split(string)"/> for proper clickable links Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b821eca to
38c50c5
Compare
gewarren
approved these changes
Apr 17, 2026
- Add 'Gets' verb prefix to Capture.Index summary - Remove unnecessary <description> tags from bullet list items (CaptureCollection, RegexMatchTimeoutException) - Use <term>/<description> for definition-style list items (MatchCollection) - Fix param description casing (CaptureCollection indexer) - Convert relative doc links to absolute GitHub URLs (Group, Match, Regex.Match) - Convert see-also links to <related> tags (Regex class) - Simplify indexer self-reference in GroupCollection - Drop '.NET Core and .NET 5+' qualifier from CompileToAssembly exceptions - Remove redundant remarks from obsolete RegexCompilationInfo - Move XML doc comment before #if DEBUG block to fix CS1591/CS1587 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
danmoseley
added a commit
to danmoseley/dotnet-api-docs
that referenced
this pull request
Apr 17, 2026
The source of truth for System.Text.RegularExpressions XML docs is being moved to dotnet/runtime (see dotnet/runtime#127038). - Add System.Text.RegularExpressions to disallow-edits.yml GitOps policy - Set open_to_public_contributors to false in docfx.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
gewarren
pushed a commit
to dotnet/dotnet-api-docs
that referenced
this pull request
Apr 17, 2026
The source of truth for System.Text.RegularExpressions XML docs is being moved to dotnet/runtime (see dotnet/runtime#127038). - Add System.Text.RegularExpressions to disallow-edits.yml GitOps policy - Set open_to_public_contributors to false in docfx.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR description was AI/Copilot-generated.
Motivation
New APIs like
RegexOptions.AnyNewLineandRegexOptions.NonBacktrackinghave documentation in source code but only "To be added." stubs in the dotnet-api-docs repo, so they show up undocumented on learn.microsoft.com. Similarly,GeneratedRegexAttributemembers were documented in source but stubbed in the docs repo.Rather than patch these individually in the docs repo, this PR makes the source code the single source of truth by backporting the richer dotnet-api-docs content into
///comments and flipping theUseCompilerGeneratedDocXmlFileswitch. This is part of the broader initiative tracked in dotnet/dotnet-api-docs#10722.What changed
src/libraries/System.Text.RegularExpressions/src/— all changes are XML doc comments (///), with these exceptions:<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>from the csproj (flips the switch so compiler-generated XML becomes authoritative)//comments on protected fields inRegex.csto///XML doc comments (required to avoid CS1591 errors)// Callback classcomment inRegexRunnerFactory.cs(replaced by/// <summary>)Merge strategy
AnyNewLine,NonBacktracking,GeneratedRegexAttributemembers had docs in source but only "To be added." in the docs repoCompileToAssemblyremarks, Framework version notes, etc.Format conversion
Docs-repo uses a custom XML/Markdown hybrid format. This was converted to standard
///XML:///<format type="text/markdown"><remarks>,<para>,<list><c>...</c>[text](url)<see href="url">text</see><list type="table">Follow-up needed (by docs team)
Per the process in dotnet/dotnet-api-docs#10722:
System.Text.RegularExpressionsnamespace todisallow-edits.ymlopen_to_public_contributorstofalsein the API docs repoTesting