Skip to content

Fix NRT annotations in MSBuild Tasks #10277

@jonathanpeppers

Description

@jonathanpeppers

Android framework version

net10.0-android (Preview)

Affected platform version

.NET 10

Description

Many MSBuild task classes in src\Xamarin.Android.Build.Tasks\Tasks\ still use the old nullable patterns and haven't been updated to follow the repository's nullable reference types guidelines. Base these on the copilot-instructions.md.

Verify every task has #nullable enable at the top

Current pattern found:

public string NonRequiredProperty { get; set; }
public ITaskItem [] NonRequiredItemGroup { get; set; }
[Required]
public string RequiredProperty { get; set; }

Should be updated to:

public string? NonRequiredProperty { get; set; }
public ITaskItem []? NonRequiredItemGroup { get; set; }
[Required]
public string RequiredProperty { get; set; } = "";
[Required]
public ITaskItem [] RequiredItemGroup { get; set; } = [];

MSBuild task files need review, with many still having #nullable disable pragmas that should be systematically converted.

Metadata

Metadata

Assignees

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