Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.

[release/7.0.1xx] SealInternalTypes (CA1852): Don't warn for top-level type (#6278) - #6504

Merged
buyaa-n merged 1 commit into
dotnet:release/7.0.1xxfrom
jhartmann123:seal-toplevel
Mar 10, 2023
Merged

buyaa-n merged 1 commit into
dotnet:release/7.0.1xxfrom
jhartmann123:seal-toplevel

Conversation

@jhartmann123

@jhartmann123 jhartmann123 commented Feb 23, 2023 •

Copy link
Copy Markdown

Backport #6278 into the .NET7 release branch
Issue: #6141 - CA1852 warns on generated Program for top-level statements

Customer Impact

The CA1852 analyzer is hidden by default, but it is bulk configurable. Which means it is will be on if user choose to warn on all analyzers or on Performance category analyzers. Several customers asked about the porting in the issue #6141. For the customer who opened this PR they have all analyzers enabled with TreatWarningsAsErrors set to true in their project. So, they explicitly have to suppress this analyzer in order to compile. There is no workaround except suppressing the warning or upgrading to .NET 8 previews which is not desirable. Accounting that top level statements are getting more and more popular the fix better to be serviced in 7.0.

Regression

No, but if we account that the analyzer newly added in 7.0 with the bug it could cause an unexpected warning when the analyzers bulk configured to Warn

Testing

  • Unit test added with the fix
  • Manual testing done with the repro

Risk

Very low, the fix is quite simple and self-descriptive. It would not introduce a new warning nor would affect any other code/analyzer.

CC @jeffhandley @stephentoub

* SealInternalTypes (CA1852): Don't warn for top-level type

* Fix build errors
@jhartmann123
jhartmann123 requested a review from a team as a code owner February 23, 2023 20:14
@mavasani

Copy link
Copy Markdown

@buyaa-n

@buyaa-n

buyaa-n commented Feb 24, 2023 •

Copy link
Copy Markdown

@jhartmann123 personally I am supportive to port, but for porting fixes into SDK servicing releases we need to get approval from management. I will update the description with the info needed for servicing request, we need more info from you to fill the Customer impact part of the request. Why do you think the fix need to be ported and why the porting is necessary for you, are you blocked by this bug and how? Especially when the analyzer is hidden by default the customer scenario would be helpful

@jhartmann123

jhartmann123 commented Feb 25, 2023 •

Copy link
Copy Markdown
Author

I'm sorry, while not stated explicitly anywhere, some people, including me, were under the impression that this was planned to be fixed with SDK 7.0.1xx. As it still wasn't fixed with 7.0.200, I thought that this was just a missed cherry pick...

Thanks for updating the MR description, I've added our issue with this in the Customer impact part.

@jeffhandley jeffhandley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Backporting this to 7.0.x sounds good to me. It addresses a common scenario of top-level statements where a bug exists and cannot be satisfactorily worked around.

@buyaa-n Can you shepherd this through Tactics please?

@buyaa-n

buyaa-n commented Mar 10, 2023

Copy link
Copy Markdown

Servicing approved, the code coverage failure is unrelated, merging. Assuming it would just flow from 7.0.1xx branch to next 7.0 release as usual.

CC @jmarolf @mavasani

@buyaa-n

buyaa-n commented Mar 10, 2023

Copy link
Copy Markdown

Hm, could not merge, probably because of the failure? Rerunning did not work, closing and reopening the PR

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.

5 participants