dotnet / dotnet/roslyn

Add pragma to suppress all obsoletion warnings.

Open
#73,292 0 comments 2 reactions 0 assignees View on GitHub
Area-Compilers Feature Request
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Context: dotnet/runtime#101738

Source-generated files that use obsolete user-provided APIs will have obsoletion warnings themselves. The standard warning code can be suppressed at the start of the generated file, but if the API is obsoleted with a custom diagnostic ID, the warning cannot be easily suppressed just for that file.

To solve this, I propose to introduce a `#pragma warnings disable obsolete` directive that suppresses all obsoletetion warnings regardless of ID.

c.c. @RikkiGibson

Contributor guide

Open the contributing guide

Research direction

Start by reading the proposal and its linked context, dotnet/runtime#101738, to understand the source-generated-file scenario and custom obsoletion diagnostic IDs. Then locate Roslyn's pragma-warning parsing and obsoletion diagnostic handling; done means the proposed directive suppresses obsoletion warnings regardless of diagnostic ID while preserving existing warning behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.