Skip to content

Only suppress diagnostics when the interceptor is running - #1235

Merged
Andrew Arnott (AArnott) merged 1 commit into
mainfrom
dev/andarno/suppressOnIntercept
Jul 24, 2025
Merged

Only suppress diagnostics when the interceptor is running#1235
Andrew Arnott (AArnott) merged 1 commit into
mainfrom
dev/andarno/suppressOnIntercept

Conversation

@AArnott

Copy link
Copy Markdown
Member

In #1223 I added a source generator with an interceptor capability and a diagnostic suppressor. But the diagnostic suppressor ran unconditionally while the interceptor required opt-in, which would hide trim/dynamic code warnings inappropriately.
This fixes that.

CopilotAI left a comment

Copy link
Copy Markdown

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 fixes an issue where a diagnostic suppressor was running unconditionally while its corresponding interceptor required opt-in configuration, causing inappropriate suppression of trim/dynamic code warnings.

  • Extracts interceptor enablement logic into a shared utility method
  • Adds conditional check to only suppress diagnostics when interceptors are enabled

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

FileDescription
ProxyGenerator.csExtracts interceptor enablement logic into a reusable static method
AttachAOTDiagnosticSuppressor.csAdds early return when interceptors are disabled to prevent inappropriate diagnostic suppression

Sign up for freeto 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.

3 participants

@AArnott@RyanToth3