Skip to content

Regression: incorrect nullability annotations in Xamarin.AndroidX.AppCompat 1.8.0 #1558

Open

Description

@Bip901

Android framework version

net10.0-android

Affected platform version

.NET 10.0.400

Description

Xamarin.AndroidX.AppCompat used to have correct C# nullability annotations in version 1.7.1.4, but they're gone in version 1.8.0, resulting in numerous build warnings.

This is not an isolated incident; A similar regression exists for the latest version of AndroidX.Fragment.App (e.g. in Fragment.GetString). My guess is the nullable annotations are not being properly bound from Java.

Steps to Reproduce

  1. Create a project:
dotnet new androidlib
dotnet package add '[email protected]'
  1. Add the following code:
public class Class1
{
    public void X()
    {
        AndroidX.AppCompat.App.AlertDialog dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(null!).Create();
        //  Code is valid because the return value of Create() is non-null
    }
}
  1. dotnet build and observe the build warnings:
Class1.cs(9,53): warning CS8600: Converting null literal or possible null value to non-nullable type.
  1. Downgrade to 1.7.1.4 and observe the warnings are gone

Did you find any workaround?

No response

Relevant log output

Activity

  1. Cheesebaron commented on Oct 23, 2026

    @Cheesebaron

    Same in Xamarin.AndroidX.Fragment 1.9.0 and Xamarin.AndroidX.ConstraintLayout 2.2.2.

    I reported something similar last year: #1136 which I am not sure has been addressed and I believe the issue reported here is a duplicate of that.

  2. Bip901 commented on Oct 23, 2026

    @Bip901
    Author

    It's the same kind of problem, though my issue is about the worsening of the existing state - classes which used to be annotated correctly in previous versions.

  3. Cheesebaron commented on Nov 11, 2026

    @Cheesebaron

    This is also an issue when targeting net11.0-android. So I don't believe the backport that mentions this ticket solves it alone? @jonathanpeppers

  4. jonathanpeppers commented on Nov 11, 2026

    @jonathanpeppers
    Member

    net11.0-android in your app wouldn't matter this repo is building w/ net10.0-android.

    We will need to ship the commit above in a service release, before this repo can be updated and rebuild w/ a newer .NET 10 Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions