Fix TemplateEngine RS0016/RS0041 public API analyzer violations#53978
Merged
MichaelSimons merged 3 commits intodotnet:mainfrom Apr 21, 2026
Merged
Conversation
- Remove RS0016 and RS0041 from NoWarn in TemplateEngine Directory.Build.props
- Add dotnet_diagnostic.RS0041.severity = suggestion to .editorconfig
(matching the setting from the templating repo)
- Add missing compiler-synthesized members to PublicAPI files:
- VulnerabilityInfo record struct members (Equals, GetHashCode, ToString,
==, !=, Deconstruct) in Abstractions
- Delegate Invoke methods for KeysChangedEventHander, ValueReadEventHander
in Core.Contracts
- Delegate Invoke methods for ConditionEvaluator, TypeConverterDelegate<T>
in Core
- Delegate Invoke methods for RunInstantiation, ScrubFileByPath,
VerifyDirectory in Authoring.TemplateVerifier
These were not detected by the older PublicApiAnalyzers v3.3.4 used in the
templating repo but are flagged by v5.7.0 used in the SDK repo.
Resolves part of dotnet/templating#10085
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes TemplateEngine’s suppression of PublicApiAnalyzers RS0016/RS0041 and updates the tracked public surface area to account for compiler-synthesized members that are now detected by the SDK’s newer analyzer version.
Changes:
- Removed RS0016/RS0041 from
src/TemplateEngine/Directory.Build.propsNoWarn. - Adjusted TemplateEngine analyzer configuration by adding an RS0041 severity override in
src/TemplateEngine/.editorconfig. - Updated multiple
PublicAPI.*.txtfiles to include synthesized members (delegateInvoke, record struct synthesized members).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/TemplateEngine/Tools/Microsoft.TemplateEngine.Authoring.TemplateVerifier/PublicAPI.Unshipped.txt | Adds delegate Invoke entries required by PublicApiAnalyzers. |
| src/TemplateEngine/Microsoft.TemplateEngine.Core/PublicAPI.Shipped.txt | Adds shipped delegate Invoke entries required by PublicApiAnalyzers. |
| src/TemplateEngine/Microsoft.TemplateEngine.Core.Contracts/PublicAPI.Unshipped.txt | Adds delegate Invoke entries (note: placement vs shipped needs adjustment). |
| src/TemplateEngine/Microsoft.TemplateEngine.Abstractions/PublicAPI.Unshipped.txt | Adds synthesized record-struct members required by PublicApiAnalyzers. |
| src/TemplateEngine/Directory.Build.props | Removes analyzer suppressions from NoWarn. |
| src/TemplateEngine/.editorconfig | Sets RS0041 severity to suggestion for TemplateEngine projects. |
Co-authored-by: Copilot <[email protected]>
KeysChangedEventHander and ValueReadEventHander are already shipped types, so their synthesized Invoke methods belong in Shipped.txt. Co-authored-by: Copilot <[email protected]>
NikolaMilosavljevic
approved these changes
Apr 21, 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.
Summary
After merging the templating repo into the SDK, the RS0016 and RS0041 public API analyzer rules were suppressed via
NoWarninsrc/TemplateEngine/Directory.Build.props. This PR removes that suppression and fixes the underlying issues.Root Cause
The SDK repo uses PublicApiAnalyzers v5.7.0 which detects compiler-synthesized members (delegate
Invokemethods,record structequality/deconstruct members) that the templating repo's v3.3.4 did not flag. ThePublicAPI.*.txtfiles were correct for the old analyzer but incomplete for the new one.Changes
NoWarndotnet_diagnostic.RS0041.severity = suggestion(matching the templating repo's.editorconfig)VulnerabilityInforecord struct members (Abstractions)Invokemethods (Core.Contracts, Core, Authoring.TemplateVerifier)contributes to dotnet/templating#10085