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
Visual Studio 17.4.0 Prv 1.0:
Xamarin.Android version (12/13):
Xamarin.AndroidX.Navigation.Fragment 2.5.1
@moljac
I recently updated from Xamarin.AndroidX.Navigation.Fragment 2.4.2 to 2.5.1 and because of deprecations on OnCreateOptionsMenu, OnPrepareOptionsMenu, OnOptionsItemSelected etc I got a heap of warnings. However, I noticed that SetHasOptionsMenu (or C# HasOptionsMenu = bool ) has not been marked as deprecated. According to Google’s docs, it should have. 2.5.1 depends on AndroidX.Fragment 1.5.1 so the real problem is in it.
I have a couple of tutorials on using Android’s NavigationComponent, so you could use those as test apps for catching new changes in both Navigation.Fragment and Navigation.UI as there hardly ever seems to be a point release that either breaks something or deprecates something.
To see the warnings (and the missing warning) you could download NavigationGraph5 and then just upgrade those two packages and rebuild.
NavigationGraph6 contains updated code using the new IMenuProvider and IMenuHost interfaces, so could be used for future changes to these packages.
The issue is that the setter SetHasOptionsMenu is @Deprecated, however the getter HasOptionsMenu is not.
This was a limitation of C# that you cannot place [Obsolete] on a property accessor which is what we would need to do:
publicboolHasOptionsMenu{get;[Obsolete]set;}
error CS1667: Attribute 'System.ObsoleteAttribute' is not valid on property or event accessors. It is only valid on
'class, struct, enum, constructor, method, property, indexer, field, event, interface, delegate' declarations.
This appears to have been fixed in newer versions of the C# language, so I have filed an issue for our bindings generator to support it: dotnet/java-interop#1033.
Version Information
Visual Studio 17.4.0 Prv 1.0:
Xamarin.Android version (12/13):
Xamarin.AndroidX.Navigation.Fragment 2.5.1
@moljac
I recently updated from Xamarin.AndroidX.Navigation.Fragment 2.4.2 to 2.5.1 and because of deprecations on OnCreateOptionsMenu, OnPrepareOptionsMenu, OnOptionsItemSelected etc I got a heap of warnings. However, I noticed that SetHasOptionsMenu (or C# HasOptionsMenu = bool ) has not been marked as deprecated. According to Google’s docs, it should have. 2.5.1 depends on AndroidX.Fragment 1.5.1 so the real problem is in it.
I have a couple of tutorials on using Android’s NavigationComponent, so you could use those as test apps for catching new changes in both Navigation.Fragment and Navigation.UI as there hardly ever seems to be a point release that either breaks something or deprecates something.
To see the warnings (and the missing warning) you could download NavigationGraph5 and then just upgrade those two packages and rebuild.
NavigationGraph6 contains updated code using the new IMenuProvider and IMenuHost interfaces, so could be used for future changes to these packages.
https://github.com/gmck/NavigationGraph5
https://github.com/gmck/NavigationGraph6
The text was updated successfully, but these errors were encountered: