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 }}
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Are there any plans to update the Xamarin.Android bindings (and the generator it self) to support C# 8 nullability?
Since Kotlin adoption by Google the Java Android SDK and the AndroidX libraries have been enhanced to expose the @nullable annotation to help Kotlin indicate if it a value can be null or not.
The bindings generator could also leverage the @nullable annotation to expose C# 8 nullable types.
On Xamarin.iOS there is an issue already opened to capture this dotnet/macios#6154 and since I didn't find one for Xamarin.Android I've decided to open one myself.
It's something we've started discussing over the past few weeks. Currently we are working on bringing C# 8's default interface methods to Xamarin.Android, as it's a large gap compared to Java we've needed for a long time.
Nullable reference types is one of the things we are considering after that. It's good to know that the Android SDK has been annotated in a way we should be able to use. That was one of the questions we had that we hadn't explored yet. Obviously that makes the feature much more valuable instead of just marking everything as nullable because we don't actually know.
Related: in order to reasonably map the @nullable annotation -- do we know the exact type involved here? Kotlin appears to use org.jetbrains.annotations.NotNull -- we'll need to add support for parsing annotations -- PR #467 is a start, but it only handles types, not parameters -- but also propagate that info into the XML description.
Activity
jpobst commentedon Aug 13, 2019
It's something we've started discussing over the past few weeks. Currently we are working on bringing C# 8's default interface methods to Xamarin.Android, as it's a large gap compared to Java we've needed for a long time.
Nullable reference types is one of the things we are considering after that. It's good to know that the Android SDK has been annotated in a way we should be able to use. That was one of the questions we had that we hadn't explored yet. Obviously that makes the feature much more valuable instead of just marking everything as nullable because we don't actually know.
jonpryor commentedon Aug 14, 2019
Related: in order to reasonably map the
@nullableannotation -- do we know the exact type involved here? Kotlin appears to useorg.jetbrains.annotations.NotNull-- we'll need to add support for parsing annotations -- PR #467 is a start, but it only handles types, not parameters -- but also propagate that info into the XML description.We'd presumably need
RuntimeVisibleParameterAnnotationsandRuntimeInvisibleParameterAnnotationsparsing support.mattleibow commentedon Aug 14, 2019
@jonpryor There is this SO post with a list: https://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use
[Xamarin.Android.Tools.Bytecode] Add @not-null support (#526)
[generator] Add nullable reference types (NRT) support. (#563)
[generator] Add nullable reference types (NRT) support. (#563)
[generator] Add nullable reference types (NRT) support. (dotnet#563)