-
Notifications
You must be signed in to change notification settings - Fork 531
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
[Xamarin.Android.Build.Tasks] Add support for $(AndroidEnableObsoleteOverrideInheritance). #8393
Conversation
…OverrideInheritance).
@@ -469,6 +469,15 @@ Support for this property was added in Xamarin.Android 5.1. | |||
|
|||
This property is `False` by default. | |||
|
|||
## AndroidEnableObsoleteOverrideInheritance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a .NET 8 section for this doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. We do not expect ~anyone to actually use this, however there was an internal customer with a very custom setup that hit this and we did need to provide an opt-out. Thus we do not intend to widely document or suggest its usage.
…OverrideInheritance). (#8393) Context: dotnet/java-interop@8e63cc8 Context: dotnet/java-interop@d0231c5 dotnet/java-interop@d0231c5c updated generator output so that `[Obsolete]` would automagically "flow" to derived types and method overrides, so that [warning CS0672][0] would not be emitted. Before dotnet/java-interop@d0231c5c, we would emit: public class Context { [Obsolete] public virtual void SetWallpaper () { … } } public class ContextWrapper : Context { [ObsoletedOSPlatform ("android23.0")] public override void SetWallpaper () { … } } `ContextWrapper.SetWallpaper()` would elicit a CS0672 warning: warning CS0672: Member 'ContextWrapper.SetWallpaper()' overrides obsolete member 'Context.SetWallpaper()'. Add the Obsolete attribute to 'ContextWrapper.SetWallpaper()' With dotnet/java-interop@d0231c5c, we now emit the following, which no longer emits CS0672: public class Context { [Obsolete] public virtual void SetWallpaper () { … } } public class ContextWrapper : Context { [Obsolete] public override void SetWallpaper () { … } } While we feel that this is a nice improvement, this broke some customers who didn't want their bindings to automatically gain `[Obsolete]` "just because" they were overriding `[Obsolete]` types or members. In dotnet/java-interop@8e63cc8d, we added the ability to globally *opt-out* of this new behavior by using `generator --lang-features=do-not-fix-obsolete-overrides`. Add a new `$(AndroidEnableObsoleteOverrideInheritance)` MSBuild property. When False, this adds `generator --lang-features=do-not-fix-obsolete-overrides`, preventing the automatic CS0672 fix behavior. By default `$(AndroidEnableObsoleteOverrideInheritance)` is True. [0]: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0672
* main: [Xamarin.Android.Build.Tasks] Add support for $(AndroidEnableObsoleteOverrideInheritance). (dotnet#8393) [Xamarin.Android.Build.Tasks] Make manifestmerger.jar the default. (dotnet#8392)
…OverrideInheritance). (#8393) Context: dotnet/java-interop@8e63cc8 Context: dotnet/java-interop@d0231c5 dotnet/java-interop@d0231c5c updated generator output so that `[Obsolete]` would automagically "flow" to derived types and method overrides, so that [warning CS0672][0] would not be emitted. Before dotnet/java-interop@d0231c5c, we would emit: public class Context { [Obsolete] public virtual void SetWallpaper () { … } } public class ContextWrapper : Context { [ObsoletedOSPlatform ("android23.0")] public override void SetWallpaper () { … } } `ContextWrapper.SetWallpaper()` would elicit a CS0672 warning: warning CS0672: Member 'ContextWrapper.SetWallpaper()' overrides obsolete member 'Context.SetWallpaper()'. Add the Obsolete attribute to 'ContextWrapper.SetWallpaper()' With dotnet/java-interop@d0231c5c, we now emit the following, which no longer emits CS0672: public class Context { [Obsolete] public virtual void SetWallpaper () { … } } public class ContextWrapper : Context { [Obsolete] public override void SetWallpaper () { … } } While we feel that this is a nice improvement, this broke some customers who didn't want their bindings to automatically gain `[Obsolete]` "just because" they were overriding `[Obsolete]` types or members. In dotnet/java-interop@8e63cc8d, we added the ability to globally *opt-out* of this new behavior by using `generator --lang-features=do-not-fix-obsolete-overrides`. Add a new `$(AndroidEnableObsoleteOverrideInheritance)` MSBuild property. When False, this adds `generator --lang-features=do-not-fix-obsolete-overrides`, preventing the automatic CS0672 fix behavior. By default `$(AndroidEnableObsoleteOverrideInheritance)` is True. [0]: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0672
Context: dotnet/java-interop#1143
Context: dotnet/java-interop#1130
In dotnet/java-interop#1143, we added the ability to globally opt-out of the new
generator
feature that automatically applies[Obsolete]
attributes to methods that override[Obsolete]
methods. (Preventing a C# compiler warning.)This adds support for a new
$(AndroidEnableObsoleteOverrideInheritance)
boolean MSBuild property for users to opt-out. The default istrue
.