Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve CustomObsoleteDiagnosticInfo when changing severity #47777

Merged
merged 3 commits into from
Sep 18, 2020

Conversation

RikkiGibson
Copy link
Contributor

Closes #47736

Need to make a pass to add tests, but I think this fixes the problem.

@RikkiGibson RikkiGibson marked this pull request as ready for review September 17, 2020 16:45
@RikkiGibson RikkiGibson requested a review from a team as a code owner September 17, 2020 16:45
@@ -50,6 +56,11 @@ public override DiagnosticDescriptor Descriptor
}
}

internal override DiagnosticInfo GetInstanceWithSeverity(DiagnosticSeverity severity)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you look at the other types that derive from DiagnosticInfo to see if they needed to also override this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only one because it's the only one that overrides Descriptor and MessageIdentifier.

@RikkiGibson
Copy link
Contributor Author

RikkiGibson commented Sep 17, 2020

I continue to get integration failures in release mode after 3 attempts:

##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4652,5): error MSB3030: Could not copy the file "F:\workspace\_work\1\s\artifacts\obj\CompilersBoundTreeGenerator\x64\Release\netcoreapp3.1\BoundTreeGenerator.exe" because it was not found.

I believe my change does not impact the build's ability to produce and copy this file to wherever it belongs, therefore I will force merge this PR for expediency. This hasn't been approved yet, I got mixed up 😅

@RikkiGibson
Copy link
Contributor Author

@AlekseyTs could you please take a look at this PR?

@jaredpar
Copy link
Member

Mail was just sent, integration tests are broken at the moment. I'm going to remove the required bit for the time being.

);

verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Hidden),
// (6,9): warning TEST1: 'C1.M1()' is obsolete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning [](start = 26, length = 7)

"hidden"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, must have been a copy-paste issue. This severity is not actually verified, so I will just modify the comment.

verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS0618", ReportDiagnostic.Suppress)),
// (6,9): warning TEST1: 'C1.M1()' is obsolete
// M1(); // 1
Diagnostic("TEST1", "M1()", isSuppressed: false).WithArguments("C1.M1()").WithLocation(6, 9)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diagnostic("TEST1", "M1()", isSuppressed: false).WithArguments("C1.M1()").WithLocation(6, 9) [](start = 16, length = 92)

Why isn't this diagnostic suppressed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppressions to CS0618 don't apply to this diagnostic. See #42119

@@ -137,7 +137,7 @@ internal DiagnosticInfo(CommonMessageProvider messageProvider, bool isWarningAsE
}

// Create a copy of this instance with a explicit overridden severity
internal DiagnosticInfo GetInstanceWithSeverity(DiagnosticSeverity severity)
internal virtual DiagnosticInfo GetInstanceWithSeverity(DiagnosticSeverity severity)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Half of me wants to make this method abstract to force all derived types to acknowledge this potential issue. The other half of me thinks that's a bit overkill here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it makes me wish for the ability to say "all of these members in the group must be overridden, or none of them".

@RikkiGibson RikkiGibson merged commit b523cbe into dotnet:master Sep 18, 2020
@ghost ghost added this to the Next milestone Sep 18, 2020
@RikkiGibson RikkiGibson deleted the fix-47736 branch September 18, 2020 02:27
@dibarbet dibarbet modified the milestones: Next, 16.8.P4 Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect error codes reported
4 participants