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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seal internal types #677

Merged
merged 3 commits into from Apr 26, 2023
Merged

Seal internal types #677

merged 3 commits into from Apr 26, 2023

Conversation

stephentoub
Copy link
Member

Motivation and Context

Seal internal types.

Description

These would normally be flagged by CA1852, but it's currently unable to handle assemblies marked as InternalsVisibleTo, and all of these assemblies are. Sealing internal types is generally a good practice as a) it can always be changed so there's little downside, b) it can help to communicate to elsewhere in the project whether the type is intended to be derived from (just as using visibility on members communicates what should / shouldn't be used), and c) it can help with performance in some situations, especially on .NET Core.

Contribution Checklist

These would normally be flagged by CA1852, but it's currently unable to handle assemblies marked as InternalsVisibleTo, and all of these assemblies are.  Sealing internal types is generally a good practice as a) it can always be changed so there's little downside, b) it can help to communicate to elsewhere in the project whether the type is intended to be derived from (just as using visibility on members communicates what should / shouldn't be used), and c) it can help with performance in some situations, especially on .NET Core.
@github-actions github-actions bot added .NET Issue or Pull requests regarding .NET code kernel.core labels Apr 26, 2023
@lemillermicrosoft lemillermicrosoft added the PR: ready to merge PR has been approved by all reviewers, and is ready to merge. label Apr 26, 2023
@adrianwyatt adrianwyatt enabled auto-merge (squash) April 26, 2023 23:29
@adrianwyatt adrianwyatt self-assigned this Apr 26, 2023
@adrianwyatt adrianwyatt merged commit 024355f into microsoft:main Apr 26, 2023
11 checks passed
dluc pushed a commit that referenced this pull request Apr 29, 2023
### Motivation and Context
Seal internal types.

### Description

These would normally be flagged by CA1852, but it's currently unable to
handle assemblies marked as InternalsVisibleTo, and all of these
assemblies are. Sealing internal types is generally a good practice as
a) it can always be changed so there's little downside, b) it can help
to communicate to elsewhere in the project whether the type is intended
to be derived from (just as using visibility on members communicates
what should / shouldn't be used), and c) it can help with performance in
some situations, especially on .NET Core.
dehoward pushed a commit to lemillermicrosoft/semantic-kernel that referenced this pull request Jun 1, 2023
### Motivation and Context
Seal internal types.

### Description

These would normally be flagged by CA1852, but it's currently unable to
handle assemblies marked as InternalsVisibleTo, and all of these
assemblies are. Sealing internal types is generally a good practice as
a) it can always be changed so there's little downside, b) it can help
to communicate to elsewhere in the project whether the type is intended
to be derived from (just as using visibility on members communicates
what should / shouldn't be used), and c) it can help with performance in
some situations, especially on .NET Core.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code PR: ready to merge PR has been approved by all reviewers, and is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants