You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This rule should make sure that a member that is protected or protected internal in the implementation is the same in the contract and is not promoted to public.
The text was updated successfully, but these errors were encountered:
https://docs.microsoft.com/en-us/dotnet/core/compatibility/ mentions that
✔️ ALLOWED: Expanding the visibility of a type
✔️ ALLOWED: Restricting the visibility of a protected member when the type has no accessible (public or protected) constructors, or the type is sealed.
❌ DISALLOWED: Reducing the visibility of a type
so I think the rule should be mostly checking for the opposite of what is in the first comment.
Those compatibility rules are for "Modifications to the public contract", but the description of this issue is in terms of "contract" vs. "implementation". If the contract assembly defines a member as public but the implementation assembly defines it as protected, then a non-derived class in a project that references the contract can access the member at compile time, but the access will fail at run time when the implementation is used. So the description is correct although written as if the implementation comes before the contract.
This change adds a rule to check that the visibility of a symbol does not change.
- By default, when not run in strict mode, it checks that the visibility of the symbol is not reduced.
- However, in strict mode, it also checks that the visibility is not expanded.
Fixes#23904
This change adds a rule to check that the visibility of a symbol does not change.
- By default, when not run in strict mode, it checks that the visibility of the symbol is not reduced.
- However, in strict mode, it also checks that the visibility is not expanded.
Fixesdotnet#23904
This rule should make sure that a member that is protected or protected internal in the implementation is the same in the contract and is not promoted to public.
The text was updated successfully, but these errors were encountered: