Skip to content

Document Assert interpolated-string-handler structs (#9060) - #9072

Merged
Amaury Levé (Evangelink) merged 2 commits into
mainfrom
dev/amauryleve/issue-9060-assert-handlers
Jun 12, 2026
Merged

Amaury Levé (Evangelink) merged 2 commits into
mainfrom
dev/amauryleve/issue-9060-assert-handlers

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Addresses tasks 1, 2, and 4 of #9060.

The 9 Assert.*.cs partials in src/TestFramework/TestFramework/Assertions/ each had a #pragma warning disable CS1591 block wrapping an [EditorBrowsable(EditorBrowsableState.Never)] InterpolatedStringHandler struct. This PR:

  1. Adds XML <summary> / <param> comments to each handler struct and its public constructors and AppendLiteral / AppendFormatted members.
  2. Removes the #pragma warning disable CS1591 / #pragma warning restore CS1591 lines, so future undocumented public API on these types will surface again.

These types are still EditorBrowsable(Never), so this doesn't change the user-facing IntelliSense surface; it just closes the doc gap so we can later promote CS1591 to a build error (task 5 of #9060).

Verification

  • dotnet build src/TestFramework/TestFramework/TestFramework.csproj succeeds with 0 warnings.
  • No remaining #pragma warning disable CS1591 under src/TestFramework/.

Adds XML <summary> / <param> documentation to all public members of the
[EditorBrowsable(Never)] InterpolatedStringHandler structs in the Assert
partials, and removes the per-file '#pragma warning disable CS1591'
blocks now that the gap is closed.

Touches: Assert.AreEqual.InterpolatedStringHandlers, Assert.AreSame,
Assert.ContainsSingle, Assert.Count, Assert.IsExactInstanceOfType,
Assert.IsInstanceOfType, Assert.IsNull, Assert.IsTrue,
Assert.ThrowsException.

Part of #9060.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 12, 2026 12:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves XML documentation coverage for MSTest Assert interpolated-string-handler structs (which are EditorBrowsable(Never) and primarily compiler-consumed), and removes the #pragma warning disable/restore CS1591 blocks so future undocumented public APIs will surface CS1591 warnings again.

Changes:

  • Adds <summary> / <remarks> / <param> / <typeparam> XML docs to the interpolated string handler structs and their public constructors / AppendLiteral / AppendFormatted members across multiple Assert.*.cs partials.
  • Removes #pragma warning disable CS1591 / #pragma warning restore CS1591 around these structs.
  • Expands documentation for handler overloads including span-based AppendFormatted members and optional-parameter overloads (retaining existing RS0026/RS0027 pragmas where applicable).
Show a summary per file
File Description
src/TestFramework/TestFramework/Assertions/Assert.ThrowsException.cs Documents handlers for Assert.Throws* / Assert.ThrowsExactly* message formatting without eager allocations; removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.IsTrue.cs Documents handlers for Assert.IsTrue / Assert.IsFalse; removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.IsNull.cs Documents handlers for Assert.IsNull / Assert.IsNotNull; removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.IsInstanceOfType.cs Documents handlers for instance-of-type assertions (generic and non-generic); removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.IsExactInstanceOfType.cs Documents handlers for exact-instance-of-type assertions (generic and non-generic); removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.Count.cs Documents handlers for count/emptiness assertions; removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.ContainsSingle.cs Documents handler for Assert.ContainsSingle overloads; removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.AreSame.cs Documents handlers for Assert.AreSame / Assert.AreNotSame; removes CS1591 pragmas.
src/TestFramework/TestFramework/Assertions/Assert.AreEqual.InterpolatedStringHandlers.cs Documents handlers for Assert.AreEqual / Assert.AreNotEqual overloads (generic and non-generic variants); removes CS1591 pragmas.

Copilot's findings

  • Files reviewed: 9/9 changed files
  • Comments generated: 1

@Evangelink Amaury Levé (Evangelink) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Automated review by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

✅ 22/22 dimensions clean — no findings.

Scope verified: 9 files in src/TestFramework/TestFramework/Assertions/, pure XML-doc addition with #pragma warning disable/restore CS1591 removal.

Documentation accuracy spot-checks passed:

Struct <summary> references ✓
AssertIsNotExactInstanceOfTypeInterpolatedStringHandler Assert.IsNotExactInstanceOfType ✓
AssertGenericIsNotExactInstanceOfTypeInterpolatedStringHandler<TArg> Assert.IsNotExactInstanceOfType ✓
AssertIsExactInstanceOfTypeInterpolatedStringHandler Assert.IsExactInstanceOfType ✓
AssertGenericIsExactInstanceOfTypeInterpolatedStringHandler<TArg> Assert.IsExactInstanceOfType ✓
AssertAreEqualInterpolatedStringHandler<TArgument> Assert.AreEqual ✓
AssertAreNotEqualInterpolatedStringHandler<TArgument> Assert.AreNotEqual ✓
AssertNonGenericAreEqualInterpolatedStringHandler Assert.AreEqual ✓
AssertNonGenericAreNotEqualInterpolatedStringHandler Assert.AreNotEqual ✓
AssertAreSameInterpolatedStringHandler<TArgument> Assert.AreSame ✓
AssertAreNotSameInterpolatedStringHandler<TArgument> Assert.AreNotSame ✓
AssertCountInterpolatedStringHandler<TItem> Assert.Count and Assert.HasCount ✓
AssertIsNotEmptyInterpolatedStringHandler<TItem> Assert.IsNotEmpty ✓
AssertSingleInterpolatedStringHandler<TItem> Assert.ContainsSingle ✓
AssertIsNullInterpolatedStringHandler Assert.IsNull ✓
AssertIsNotNullInterpolatedStringHandler Assert.IsNotNull ✓
AssertIsTrueInterpolatedStringHandler Assert.IsTrue ✓
AssertIsFalseInterpolatedStringHandler Assert.IsFalse ✓
AssertNonStrictThrowsInterpolatedStringHandler<TException> Assert.Throws ✓
AssertThrowsExactlyInterpolatedStringHandler<TException> Assert.ThrowsExactly ✓

Alleged copy-paste bug (pre-flagged for investigation): Verified not present. AssertIsNotExactInstanceOfTypeInterpolatedStringHandler correctly references Assert.IsNotExactInstanceOfType in its <summary> (line 246 of Assert.IsExactInstanceOfType.cs).

Additional checks:

  • All #pragma warning disable/restore CS1591 pairs removed from all 9 files ✓
  • All constructors have non-empty <summary> with accurate <param> tags (literalLength, formattedCount, domain-specific params, shouldAppend) ✓
  • All AppendLiteral/AppendFormatted overloads documented ✓
  • No new public API surface introduced; PublicAPI.Unshipped.txt correctly not modified ✓
  • No logic changes — dimensions 1–3, 5–16, 18–22 are N/A for this pure-documentation PR ✓

🤖 Automated content by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review (on PR ready) workflow. · 1K AIC · ⌖ 12.3 AIC · ◷

The summary previously referenced `Assert.Count`, which does not exist in the
codebase. The handler is actually consumed by the `Assert.HasCount` and
`Assert.IsEmpty` overloads (see the overloads that take
`AssertCountInterpolatedStringHandler`). Update the summary to reference the
real APIs.

Co-authored-by: Copilot <[email protected]>
@Evangelink
Amaury Levé (Evangelink) merged commit 0739590 into main Jun 12, 2026
19 of 28 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/issue-9060-assert-handlers branch June 12, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants