Skip to content

[fix-finder] Remove obsolete SetAndroidSupportedAbis usage from test code #11389

@github-actions

Description

@github-actions

Problem

The SetAndroidSupportedAbis extension methods in ProjectExtensions.cs are marked [Obsolete] with the message "please use SetRuntimeIdentifiers instead." There are ~49 call sites across 16 test files still using the deprecated API, generating compiler warnings.

Location

  • Definition: src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Utilities/ProjectExtensions.cs (lines 15-29)
  • Callers in src/.../Tests/Xamarin.Android.Build.Tests/:
    • EnvironmentContentTests.cs (4 calls)
    • IncrementalBuildTest.cs (4 calls)
    • AotTests.cs (3 calls)
    • BuildTest.cs (2 calls)
    • BuildTest2.cs (1 call)
    • PackagingTest.cs (2 calls)
    • ManifestTest.cs (1 call)
    • Tasks/LinkerTests.cs (1 call)
  • Callers in tests/MSBuildDeviceIntegration/Tests/:
    • InstallAndRunTests.cs (12 calls)
    • InstallTests.cs (9 calls)
    • DebuggingTest.cs (3 calls)
    • MonoAndroidExportTest.cs (2 calls)
    • BundleToolTests.cs (1 call)
    • PerformanceTest.cs (1 call)
    • SystemApplicationTests.cs (1 call)
    • MarshalMethodsGCHangTests.cs (1 call)
    • AotProfileTests.cs (1 call)

Current Code

// Definition in ProjectExtensions.cs
[Obsolete ("SetAndroidSupportedAbis is deprecated, please use SetRuntimeIdentifiers instead.")]
public static void SetAndroidSupportedAbis (this IShortFormProject project, params string [] abis)
{
    project.SetRuntimeIdentifiers (abis);
}

[Obsolete ("SetAndroidSupportedAbis is deprecated, please use SetRuntimeIdentifiers instead.")]
public static void SetAndroidSupportedAbis (this IShortFormProject project, string abis)
{
    project.SetRuntimeIdentifiers (abis.Split (';'));
}

// Typical usage in tests:
proj.SetAndroidSupportedAbis ("armeabi-v7a;arm64-v8a");
app.SetAndroidSupportedAbis ("arm64-v8a");

Suggested Fix

Replace all calls to SetAndroidSupportedAbis with SetRuntimeIdentifiers:

// Single ABI (string overload) - before:
app.SetAndroidSupportedAbis ("arm64-v8a");
// After:
app.SetRuntimeIdentifiers (new[] { "arm64-v8a" });

// Multiple ABIs (semicolon-separated string overload) - before:
proj.SetAndroidSupportedAbis ("armeabi-v7a;arm64-v8a");
// After:
proj.SetRuntimeIdentifiers (new[] { "armeabi-v7a", "arm64-v8a" });

// Params overload - before:
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");
// After:
proj.SetRuntimeIdentifiers (new[] { "arm64-v8a", "x86_64" });

After all callers are migrated, remove both SetAndroidSupportedAbis overloads from ProjectExtensions.cs.

Guidelines

  • SetRuntimeIdentifiers(IEnumerable<string> androidAbis) accepts ABI names (e.g., "arm64-v8a") and internally converts them to RIDs using AbiUtils.AbiToRuntimeIdentifier
  • Don't change any test logic, assertions, or behavior — only the method call
  • Use new[] { ... } syntax for the array argument (not new string[] { ... })
  • Follow existing code style: spaces before ( and [

Acceptance Criteria

  • All 49 call sites migrated from SetAndroidSupportedAbis to SetRuntimeIdentifiers
  • Both [Obsolete] SetAndroidSupportedAbis overloads removed from ProjectExtensions.cs
  • No CS0618 warnings remain for SetAndroidSupportedAbis
  • All tests pass (no behavioral change)
  • No new warnings introduced

Generated by Nightly Fix Finder for issue #11352 · ● 3.4M ·

  • expires on May 25, 2026, 1:54 PM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions