Skip to content

Conversation

stephentoub
Copy link
Member

Every generated regex output contained multiple pragma suppressions for warnings we know to be possible. We can simplify this by just suppressing all warnings in the generated code. If there is a stray warning (e.g. because of a custom analyzer), there's nothing the developer can do about it, and it can break their build if they have warnings-as-errors.

Every generated regex output contained multiple pragma suppressions for warnings we know to be possible. We can simplify this by just suppressing all warnings in the generated code. If there is a stray warning (e.g. because of a custom analyzer), there's nothing the developer can do about it, and it can break their build if they have warnings-as-errors.
Copy link
Contributor

@Copilot Copilot AI left a comment

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 simplifies pragma warning suppressions in generated regex code by using a blanket warning suppression in release builds while maintaining specific suppressions in debug builds. This prevents build failures when custom analyzers introduce warnings that developers cannot address in generated code.

Key Changes

  • Adds conditional compilation to use specific warning suppressions in DEBUG builds
  • Uses blanket #pragma warning disable in non-DEBUG builds to suppress all warnings

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

@stephentoub stephentoub merged commit cacb702 into dotnet:main Aug 1, 2025
86 of 88 checks passed
@stephentoub stephentoub deleted the regexsuppression branch August 1, 2025 12:35
@github-actions github-actions bot locked and limited conversation to collaborators Sep 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants