KEMBAR78
Fix NRT annotations in MSBuild Tasks Legacy/ResolveAndroidTooling.cs by Copilot · Pull Request #10315 · dotnet/android · GitHub
Skip to content

Conversation

Copy link
Contributor

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 AI changed the title [WIP] Fix NRT annotations in MSBuild Tasks Fix NRT annotations in MSBuild Tasks Legacy/ResolveAndroidTooling.cs Jul 21, 2025
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
@github-actions github-actions bot locked and limited conversation to collaborators Aug 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix NRT annotations in MSBuild Tasks

2 participants