Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 10, 2025

This PR addresses build warnings in several projects by removing _AllowProjectWarnings entries from Directory.Build.props and fixing the resulting warnings.

Changes Made

Successfully Fixed Projects

Removed _AllowProjectWarnings entries and fixed warnings for:

  1. Microsoft.Android.Sdk.ILLink.csproj - No warnings found, builds cleanly
  2. Microsoft.Android.Templates.csproj - No warnings found, builds cleanly
  3. MSBuildDeviceIntegration.csproj - No warnings found, builds cleanly
  4. Xamarin.Android.Build.Tasks.csproj - Fixed 25+ warnings including:

Warning Types Fixed

  • CS0168: Removed unused exception variable in GetAotArguments.cs
  • CS0219: Removed unused assigned variable in FileResourceParser.cs
  • CS0114: Added conditional override keywords for virtual method inheritance in linker classes
  • CS0108: Added new keywords for intentional member hiding in MSBuildLinkContext.cs and JavaToolTask.cs
  • CS0618: Updated obsolete Cecil API usage:
    • ModuleDefinition.FullyQualifiedNameModuleDefinition.FileName
    • ModuleDefinition.Import()ModuleDefinition.ImportReference()
  • CS0649/CS0169/CS0414: Added pragma warning suppressions for fields used in native code generation/marshaling
  • SYSLIB0012: Updated obsolete Assembly.CodeBase usage to Assembly.Location in ProjectTools

Projects with Restored Lines

  • Xamarin.Android.Build.Tests.csproj: Contains 100+ warnings primarily from test code using deprecated APIs (SetAndroidSupportedAbis). Fixing would require updating test framework and ensuring test coverage remains intact.
  • Xamarin.ProjectTools.csproj: Fixed simple warnings but remaining warnings require platform-specific conditional compilation and HttpClient migration in test utilities.

Technical Details

The linker-related fixes use conditional compilation to handle the difference between the local build context and the ILLink context:

public
#if !ILLINK
override
#endif
void LogMessage (string message)

Fields used in native code generation are suppressed with appropriate pragma warnings rather than removed, as they are populated by the build system or native marshaling.

Build Verification

The 4 successfully fixed projects now build cleanly with TreatWarningsAsErrors=true enabled. The remaining projects retain their _AllowProjectWarnings entries due to the complexity of the required fixes.

Fixes #10279.


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

Copilot AI changed the title [WIP] Fix build warnings in this repo Fix build warnings in multiple projects by removing _AllowProjectWarnings entries Jul 10, 2025
Copilot AI requested a review from jonathanpeppers July 10, 2025 21:25
… code, clean formatting

Co-authored-by: jonathanpeppers <[email protected]>
Copilot AI requested a review from jonathanpeppers July 11, 2025 13:49
@jonathanpeppers jonathanpeppers marked this pull request as ready for review July 11, 2025 15:09
@jonathanpeppers jonathanpeppers enabled auto-merge (squash) July 11, 2025 15:10
Copilot AI requested a review from grendello July 11, 2025 15:47
@jonathanpeppers jonathanpeppers enabled auto-merge (squash) July 11, 2025 15:51
@jonathanpeppers jonathanpeppers merged commit 46af8cd into main Jul 11, 2025
59 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-10279 branch July 11, 2025 18:38
@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.

Fix build warnings in this repo

3 participants