Suppresses 0612 warnings when accessing members on obsolete classes - #11738
Open
Morten Nielsen (dotMorten) wants to merge 1 commit into
Open
Suppresses 0612 warnings when accessing members on obsolete classes#11738Morten Nielsen (dotMorten) wants to merge 1 commit into
Morten Nielsen (dotMorten) wants to merge 1 commit into
Conversation
Previously only suppressed members were suppressed, but if the entire class is obsolete, a different warning is generated.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
Author
|
/azp run |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
Mike Crider (codendone)
approved these changes
Sep 1, 2026
Mike Crider (codendone)
left a comment
Contributor
There was a problem hiding this comment.
Change looks good, but I added one comment to confirm the test passes.
| } | ||
|
|
||
| [TestMethod] | ||
| public void CodeGenerator_ObsoleteWithoutMessageSuppressesCS0612() |
Contributor
There was a problem hiding this comment.
It isn't clear if the PR pipeline ran this test. Please confirm the test passes either in the pipeline or when run locally (if the tests in this file aren't running in the pipeline).
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.
Fixes
Fixes #10855
PR Type
Description
Previously only obsolete members were suppressed in generated code, but if the entire class is obsolete, a different warning is generated.
This just adds CS0612 to the list of suppressed obsolete warnings, so both obsolete classes and members won't generate obsolete warnings in generated code.
Current Behavior
Only obsolete members are suppressed. If an entire class is obsolete, warnings aren't suppressed.
New Behavior
Both CS0612 and CS0618 gets suppressed.
Customer Impact
Enables ability to have errors-as-warnings enabled. Even if a class isn't actually being actively called by a user, having something like CreateFromString defined causes (unused) code to get generated. Here is one example where they had to suppress all obsolete warnings, risking missing other actual obsolete warnings that do need to be addressed: openclaw/openclaw-windows-node#1179
Regression Potential
How Has This Been Tested?