Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 8, 2025

Fix NRT annotations in src\Xamarin.Android.Build.Tasks\Utilities following repository guidelines

This PR systematically updates nullable reference type annotations in the Utilities directory to follow the established patterns outlined in copilot-instructions.md.

Plan

Phase 1: Convert #nullable disable to #nullable enable (5 files at a time)

  • ApplicationConfigNativeAssemblyGenerator.cs - ✅ Complex file with multiple nullable patterns fixed
  • ApplicationConfigNativeAssemblyGeneratorCLR.cs - ✅ Complex file with similar patterns fixed
  • CompressedAssembliesNativeAssemblyGenerator.cs - ✅ Simpler file with standard nullable patterns fixed
  • JniRemappingAssemblyGenerator.cs
  • ManagedMarshalMethodsLookupGenerator.cs

Phase 2: Update MSBuild Task property patterns

  • ManagedResourceParser.cs
  • ManifestDocument.cs
  • ManifestDocumentElement.cs
  • MarshalMethodsClassifier.cs
  • MarshalMethodsNativeAssemblyGenerator.cs

Phase 3: Update helper and utility classes

  • MonoAndroidHelper.cs
  • TypeMapGenerator.cs
  • TypeMappingDebugNativeAssemblyGenerator.cs
  • TypeMappingReleaseNativeAssemblyGenerator.cs
  • TypeMappingReleaseNativeAssemblyGeneratorCLR.cs

Pattern Changes Applied:

  • Convert #nullable disable to #nullable enable
  • Added default values for required string properties: string Property { get; set; } = ""
  • Added default values for collection properties: List<ITaskItem> Items { get; set; } = []
  • Made optional string/reference type fields nullable: string? field, AssemblyDescriptor? descriptor, StructureInfo? info
  • Added null coalescing for nullable parameters: param ?? defaultValue
  • Added explicit null checks where the null-forgiving operator would be inappropriate
  • Protected against null Instance properties in sort comparisons
  • Added null conditional operators where appropriate: Instance?.Property ?? defaultValue

Context #10326.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@jonathanpeppers
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers marked this pull request as ready for review August 8, 2025 21:11
@jonathanpeppers jonathanpeppers enabled auto-merge (squash) August 8, 2025 21:12
@jonathanpeppers jonathanpeppers merged commit 8456cde into main Aug 8, 2025
59 of 60 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-10326-2 branch August 8, 2025 21:41
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 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.

2 participants