Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,558 0 bình luận 1 reaction 2 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@jonathanpeppers đang làm issue này rồi.

Từ ngày 10/10/2026.

  • #1559 của @copilot-swe-agent — đã đóng, không merge

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
40/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, csharp
Lĩnh vực
mobile

Hướng nghiên cứu

Start from the reproduction: a new androidlib project referencing Xamarin.AndroidX.AppCompat 1.8.0, where AlertDialog.Builder(null!).Create() emits CS8600 but 1.7.1.4 does not. Compare the nullability annotations on the Java-bound members between the two versions, and check the same for Fragment.GetString. Done means the warnings disappear on 1.8.0 and the annotations match the Java source. The fix probably lives in binding metadata, so the maintainers' guidance on where that lives matters before editing.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C#
Star
319
Fork
73
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dotnet/android-libraries

Tất cả issue của dotnet/android-libraries

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.