Fix NRT annotations in MSBuild Tasks #10313
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the issue of updating MSBuild task classes in
src/Xamarin.Android.Build.Tasks/Tasks/
to follow the repository's nullable reference types guidelines.Changes Made
✅ Added
#nullable enable
directives#nullable enable
to 2 files that were missing it:GetNativeRuntimeComponents.cs
LinkNativeRuntime.cs
✅ Converted to extension method patterns
string.IsNullOrEmpty()
→.IsNullOrEmpty()
string.IsNullOrWhiteSpace()
→.IsNullOrWhiteSpace()
Files updated:
Aapt2Link.cs
(2 occurrences)BuildAppBundle.cs
BundleToolAdbTask.cs
CalculateLayoutCodeBehind.cs
CollectDalvikFilesForArchive.cs
CollectNativeFilesForArchive.cs
(2 occurrences)CollectNonEmptyDirectories.cs
(2 occurrences)CreateAar.cs
(2 occurrences)GetAotArguments.cs
GetAotAssemblies.cs
GetAssetPacks.cs
GetImportedLibraries.cs
ProcessAssemblies.cs
R8.cs
(5 occurrences)Results
#nullable enable
(97.3% compliance)#nullable enable
(99.3% compliance)Legacy File Note
The file
Legacy/ResolveAndroidTooling.cs
was intentionally left with#nullable disable
as it inherits from another class and would require more complex null-safety updates that go beyond the scope of minimal changes.All changes are minimal and surgical, following the repository's nullable reference types guidelines without modifying existing working code unnecessarily.
Fixes #10277.
💡 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.