Repository navigation
Suppress obsolete warnings in the static generator output - #1144
Open
akashchamp wants to merge 1 commit into
Open
akashchamp wants to merge 1 commit into
akashchamp wants to merge 1 commit into
Conversation
The generated code references every member of a [YamlSerializable] type, so an [Obsolete] type or property produced CS0612/CS0618 in YamlDotNetAutoGraph.g.cs and broke builds with TreatWarningsAsErrors. Disable both warnings alongside the ones the generator already suppresses, and add obsolete members to the AoT compile test so the build catches a regression. Fixes aaubry#1096
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 #1096
The static generator references every member of a
[YamlSerializable]type inYamlDotNetAutoGraph.g.cs, so an[Obsolete]type or property produced CS0612/CS0618 in generated code that the user can not edit. WithTreatWarningsAsErrorsthat fails the build.This adds
#pragma warning disable CS0612andCS0618to the generated file header, next to the nullability warnings it already disables. I also added an[Obsolete]class and two[Obsolete]properties (with and without a message) toYamlDotNet.Core7AoTCompileTest, which already builds withTreatWarningsAsErrors, so CI catches a regression.Verified locally with the .NET 10.0.401 SDK:
dotnet build YamlDotNet.Core7AoTCompileTest -c Releasefails with 70 CS0612/CS0618 errors, all inYamlDotNetAutoGraph.g.cs.dotnet build YamlDotNet.sln -c Releasesucceeds, anddotnet test YamlDotNet.Test -c Releasepasses (2013/2013 on net8.0 and net10.0).