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
{{ message }}
Repository navigation
Hide Java.Lang.Object members meant only for internal use #4582
Hi, this is not a very important issue, but something I guess would make a dev's life a bit easier :)
I work with Xamarin.Android so I use mostly objects that are bound from Java libs so they inherit from the Java.Lang.Object class. The problem here is that it has a few public members that are intended for internal Java.Interop use only. For instance public IntPtr Handle or public JniObjectReference PeerReference.
So I'm wondering whether it'd be possible to hide these members as they're making an unwanted noise in IntelliSense and could also possibly lead to some confusion or errors when mistakenly used. The best would of course be to make them internal or something like that or, if that's not possible, the EditorBrowsable(EditorBrowsableState.Never) attribute could be added to remove that noise.
Also it could be worth adding the [DebuggerBrowsable(DebuggerBrowsableState.Never)] attribute if the members cannot be made internal or so to hide the members when debugging.
A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this again when a Release version is available that includes the fix.
Fix included on macOS in Visual Studio 2019 for Mac version 8.7 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Previewupdater channel.
Fix included on macOS in Visual Studio 2019 for Mac version 8.7. To get the new version that includes the fix, check for the latest updates on the Stableupdater channel.
Hi, I just downloaded the latest VS 16.7 and wanted to look at this fix but I found there's a problem with classes that inherit from Java.Lang.Object that override these now hidden properties. For instance Android.App.Activity overrides ThresholdClass so it is then visible in IntelliSense and this fix has no effect :/
I guess the bindings generator will need to be updated too to add these attributes on the overrides.
Activity
bramborman commentedon Apr 18, 2020
Also it could be worth adding the
[DebuggerBrowsable(DebuggerBrowsableState.Never)]attribute if the members cannot be made internal or so to hide the members when debugging.jpobst commentedon Apr 20, 2020
Unfortunately they cannot be made
internal, as they are used by bindings libraries.I really like your idea to at least hide them from the editor/debugger. I'll look into doing that!
I'm going to move this to the Xamarin.Android repo, as the code for
Java.Lang.Objectis actually over there.[Mono.Android] Hide "internal" members of JLO from IDEs (#4583)
[Mono.Android] Hide "internal" members of JLO from IDEs (#4583)
brendanzagaeski commentedon May 20, 2020
Release status update
A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this again when a Release version is available that includes the fix.
Fix included in Xamarin.Android 10.3.99.230.
Fix included on Windows in Visual Studio 2019 version 16.7 Preview 1. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix included on macOS in Visual Studio 2019 for Mac version 8.7 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.
brendanzagaeski commentedon Aug 5, 2020
Release status update
A new Release version of Xamarin.Android has now been published that includes the fix for this item.
Fix included in Xamarin.Android SDK version 11.0.0.3.
Fix included on Windows in Visual Studio 2019 version 16.7. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/.
Fix included on macOS in Visual Studio 2019 for Mac version 8.7. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.
bramborman commentedon Aug 6, 2020
Hi, I just downloaded the latest VS 16.7 and wanted to look at this fix but I found there's a problem with classes that inherit from
Java.Lang.Objectthat override these now hidden properties. For instanceAndroid.App.ActivityoverridesThresholdClassso it is then visible in IntelliSense and this fix has no effect :/I guess the bindings generator will need to be updated too to add these attributes on the overrides.
jpobst commentedon Aug 6, 2020
Good point, I added dotnet/java-interop#688 to address this.
[generator] Hide Java.Lang.Object infrastructure (#698)