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

Add rule to seal internal and private types #41457

Merged
merged 29 commits into from
May 5, 2022
Merged

Conversation

BrennanConroy
Copy link
Member

Enabling CA1852

This seems like a mostly good change, obviously this first pass will be the worst part, but future work should be simple to react to, the analyzer will just tell you to make your type sealed 😃

Split the changes into commits for each folder in /src, so /SignalR, /Servers, /Components, etc. are all in separated commits.

The one downside is that we like to use "internals visible to" which means some types get flagged by the analyzer to be marked as sealed, but test code inherits from the type, so you need to ignore the warning with:

#pragma warning disable CA1852 // Seal internal types
internal class MyType
#pragma warning restore CA1852 // Seal internal types

@Pilchie Pilchie added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label May 2, 2022
@BrennanConroy
Copy link
Member Author

Giving other reviewers until EOD Wednesday PST to give any feedback otherwise merging.

@BrennanConroy BrennanConroy merged commit 3ea008c into main May 5, 2022
@BrennanConroy BrennanConroy deleted the brecon/sealed2 branch May 5, 2022 16:26
@ghost ghost added this to the 7.0-preview5 milestone May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants