Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 10, 2025

This PR systematically modernizes MSBuild task properties in src/Xamarin.Android.Build.Tasks/Tasks/ to follow the repository's nullable reference types guidelines as outlined in .github/copilot-instructions.md.

Changes Made

Updated 4 MSBuild task files from #nullable disable to #nullable enable with proper nullable annotations:

  • Javac.cs: Updated properties and converted string.IsNullOrEmpty() calls to extension method pattern
  • Aot.cs: Updated properties with proper null handling for nullable property access
  • GetJavaPlatformJar.cs: Updated properties, method signatures, and comprehensive null handling
  • CheckGoogleSdkRequirements.cs: Updated properties and nullable value type handling

Pattern Updates Applied

Required Properties: Added default values

// Before
[Required]
public string RequiredProperty { get; set; }

// After  
[Required]
public string RequiredProperty { get; set; } = "";

Non-Required Properties: Made nullable

// Before
public string NonRequiredProperty { get; set; }
public ITaskItem[] NonRequiredItemGroup { get; set; }

// After
public string? NonRequiredProperty { get; set; }
public ITaskItem[]? NonRequiredItemGroup { get; set; }

Output Properties: Made nullable since they are set during execution

// Before
[Output]
public string OutputProperty { get; set; }

// After
[Output] 
public string? OutputProperty { get; set; }

String Checks: Converted to extension method pattern

// Before
if (!string.IsNullOrEmpty(property)) { }

// After
if (!property.IsNullOrEmpty()) { }

Scope

This addresses part of the broader modernization effort across 145 task files:

  • ✅ 4 files converted from #nullable disable to #nullable enable
  • 🔄 20 remaining files with #nullable disable to convert
  • 🔄 117 files without nullable pragmas need evaluation

Testing

All updated files compile successfully without nullable reference type warnings or errors. The changes preserve existing functionality while improving type safety.

Addressing #10277.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/svg-android/svg-android.jar
    • Triggering command: /home/REDACTED/work/android/android/bin/Debug/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/android/android/bin/TestDebug/net9.0/Xamarin.Android.Build.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/android/android/bin/TestDebug/net9.0/Xamarin.Android.Build.Tests.deps.json /home/REDACTED/work/android/android/bin/TestDebug/net9.0/testhost.dll --port 45059 --endpoint 127.0.0.1:045059 --role client --parentprocessid 51727 --telemetryoptedin false (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Modernize MSBuild Task Properties with Nullable Reference Types [Build.Tasks] Modernize MSBuild Task Properties with Nullable Reference Types Jul 10, 2025
Copilot AI requested a review from jonathanpeppers July 10, 2025 21:22
@jonathanpeppers
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@grendello
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers marked this pull request as ready for review July 11, 2025 13:18
@jonathanpeppers jonathanpeppers enabled auto-merge (squash) July 11, 2025 13:20
@jonathanpeppers jonathanpeppers merged commit edaf9c9 into main Jul 11, 2025
60 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-10277 branch July 11, 2025 13:26
@github-actions github-actions bot locked and limited conversation to collaborators Aug 11, 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.

3 participants