Repository navigation
Treat CS1591 as a build error in MTP and TestFramework (#9060) - #9073
Conversation
Adds `<WarningsAsErrors>$(WarningsAsErrors);CS1591</WarningsAsErrors>` to `src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj` and `src/TestFramework/TestFramework/TestFramework.csproj`. Both projects already build cleanly with 0 CS1591 warnings (any remaining gaps are wrapped by `#pragma` blocks that suppress the warning at source), so this change just prevents regressions: any new public API without an XML doc comment will now break the build instead of being silently undocumented. Closes the last task of #9060. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This pull request tightens the documentation policy for the two primary public-API projects (Microsoft.Testing.Platform and MSTest TestFramework) by promoting compiler warning CS1591 (missing XML doc comments on publicly visible members) to a build error.
Changes:
- Add
CS1591toWarningsAsErrorsinMicrosoft.Testing.Platform.csproj. - Add
CS1591toWarningsAsErrorsinTestFramework.csproj.
Show a summary per file
| File | Description |
|---|---|
| src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj | Enforces CS1591 as an error so new undocumented public APIs fail the build. |
| src/TestFramework/TestFramework/TestFramework.csproj | Enforces CS1591 as an error for MSTest’s core public API assembly to prevent undocumented additions. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
Amaury Levé (Evangelink)
left a comment
There was a problem hiding this comment.
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.
MSBuild Authoring (supplemental) — LGTM
The <WarningsAsErrors>$(WarningsAsErrors);CS1591</WarningsAsErrors> pattern correctly accumulates on top of any globally established value without overwriting it — consistent with how <NoWarn>$(NoWarn);... is used throughout the repo. Placement within a <PropertyGroup> in the individual .csproj is correct. The evaluation order is sound:
src/Directory.Build.propssets<SkipArcadeNoWarnCS1591>true</SkipArcadeNoWarnCS1591>before Arcade props are imported → Arcade does not add CS1591 to$(NoWarn).- The individual project file then appends CS1591 to
$(WarningsAsErrors).
No interference with CI's /p:TreatWarningsAsErrors=true flag — both accumulate independently.
One observation (not a blocker for this PR):
TestFramework.Extensions.csproj is the project that actually ships the MSTest.TestFramework NuGet package (<PackageId>MSTest.TestFramework</PackageId>, <IsPackable>true</IsPackable>). It references TestFramework.csproj via <ProjectReference>. CS1591 is enforced per compilation unit, so any new public members declared directly in Extensions source files (rather than in the referenced assembly) would not be caught by this PR's change. In practice, Extensions appears to be primarily a packaging wrapper, so the gap is narrow. If future tasks in #9060 add enforcement to additional projects, TestFramework.Extensions.csproj would be worth including in that pass.
🤖 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. · 313.8 AIC · ⌖ 13.2 AIC · ◷
Addresses task 5 of #9060: enforce CS1591 (missing XML doc comment on publicly visible type or member) as a build error for the two main public-API projects.
Changes
Adds
<WarningsAsErrors>$(WarningsAsErrors);CS1591</WarningsAsErrors>to:src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csprojsrc/TestFramework/TestFramework/TestFramework.csprojWhy this is safe today
Both projects already build with 0 CS1591 warnings on
main:#pragma warning disable CS1591anywhere in the project.#pragma warning disable CS1591blocks around[EditorBrowsable(EditorBrowsableState.Never)]InterpolatedStringHandlerstructs; those pragmas continue to suppress the warning even when CS1591 is treated as an error. (Document Assert interpolated-string-handler structs (#9060) #9072 documents those handlers and removes the pragmas so they can't be re-applied silently.)What this prevents going forward
Any new public type or member added to these two projects without an XML
///summary will now fail the build instead of producing a warning that is easy to miss. The repo already has<GenerateDocumentationFile>true</GenerateDocumentationFile>globally and<SkipArcadeNoWarnCS1591>true</SkipArcadeNoWarnCS1591>forsrc/, so this is purely a tightening of the existing policy.Verification
dotnet build src/TestFramework/TestFramework/TestFramework.csproj→ 0 warnings / 0 errors (4 TFMs)dotnet build src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj→ 0 warnings / 0 errors (3 TFMs)Part of #9060.