Skip to content

Fix NRT annotations in MSBuild Tasks Legacy/ResolveAndroidTooling.cs #10315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 23, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 21, 2025

Fixed nullable reference type (NRT) annotations in the MSBuild Tasks to follow repository guidelines as specified in copilot-instructions.md.

Changes Made

During investigation, found that most MSBuild task files in src/Xamarin.Android.Build.Tasks/Tasks/ already have proper #nullable enable directives and correct property annotations. Only one file needed updates:

Fixed Legacy/ResolveAndroidTooling.cs:

  • ✅ Changed #nullable disable to #nullable enable
  • ✅ Updated [Output] property to be nullable: public string? TargetFrameworkVersion { get; set; }
  • ✅ Converted string.IsNullOrWhiteSpace() calls to use extension method pattern: property.IsNullOrWhiteSpace()
  • ✅ Added proper null safety checks for method parameters and return values
  • ✅ Fixed all nullable reference warnings and compilation errors

Verification

  • ✅ All MSBuild task files now have #nullable enable directive
  • ✅ All properties follow the correct patterns:
    • Non-required: public string? PropertyName { get; set; }
    • Required: [Required] public string PropertyName { get; set; } = "";
    • Output: [Output] public string? PropertyName { get; set; }
  • ✅ Build succeeds without errors
  • ✅ Changes are minimal and surgical (22 insertions, 11 deletions in 1 file)

The repository's MSBuild Tasks are now fully compliant with the nullable reference types guidelines.

Fixes #10277.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Fix NRT annotations in MSBuild Tasks Fix NRT annotations in MSBuild Tasks Legacy/ResolveAndroidTooling.cs Jul 21, 2025
@Copilot Copilot AI requested a review from jonathanpeppers July 21, 2025 19:23
Copilot finished work on behalf of jonathanpeppers July 21, 2025 19:23
@jonathanpeppers jonathanpeppers marked this pull request as ready for review July 23, 2025 15:44
@jonathanpeppers jonathanpeppers merged commit 0ffc8c1 into main Jul 23, 2025
57 of 59 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-10277 branch July 23, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix NRT annotations in MSBuild Tasks
2 participants