xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.45k stars 511 forks source link

[Generator] If a class uses the Sealed attribute it should not have protected methods. #9505

Closed mandel-macaque closed 4 years ago

mandel-macaque commented 4 years ago

As CS0628 states:

A sealed class cannot introduce a protected member because no other class will be able to inherit from the sealed class and use the protected member.

Yet the generator is creating the costructors as protected, for example we get the following warning:

build/mac/full/ReplayKit/RPScreenRecorder.g.cs(113,22): warning CS0628: ‘RPScreenRecorder.RPScreenRecorder(IntPtr)’: new protected member declared in sealed class

When generating sealed classes this should not be protected.

spouliot commented 4 years ago

dupe of https://github.com/xamarin/xamarin-macios/issues/9065