Skip to content

[fix-finder] Remove dead code referencing obsolete IncompatibleCpuAbiExceptiopn in FastDeploy.cs #11596

@github-actions

Description

@github-actions

Problem

FastDeploy.cs contains two references to the obsolete IncompatibleCpuAbiExceptiopn class (note the typo: "Exceptiopn"). This exception is never thrown anywhere in the codebase — only IncompatibleCpuAbiException (correctly spelled) is thrown (in AdbOutputParsing.cs:319). Since the misspelled class inherits from the correctly-spelled one, the base class case already catches all instances. These references are dead code guarded by #pragma warning disable CS0618 suppressions that should be removed.

Location

  • File: src/Xamarin.Android.Build.Debugging.Tasks/Tasks/FastDeploy.cs
  • Lines: 932–935 (switch case) and 1007–1009 (error_codes list entry)

Current Code

Switch statement (lines 929–937):

string GetErrorCode (Exception ex)
{
    switch (ex) {
#pragma warning disable CS0618
        case IncompatibleCpuAbiExceptiopn e:
            return "ADB0020";
#pragma warning restore CS0618
        case IncompatibleCpuAbiException e:
            return "ADB0020";
        // ...
    }
}

Error codes list (lines 1005–1010):

static readonly List<(string code, string message)> error_codes = new List<(string code , string message)> () {
    { (code: "ADB0010", message: nameof (InstallFailedException)) },
#pragma warning disable CS0618
    { (code: "ADB0020", message: nameof (IncompatibleCpuAbiExceptiopn)) },
#pragma warning restore CS0618
    { (code: "ADB0020", message: nameof (IncompatibleCpuAbiException)) },
    // ...
};

Suggested Fix

Remove the dead-code branches and their pragma suppressions:

Switch statement — remove lines 932–935:

string GetErrorCode (Exception ex)
{
    switch (ex) {
        case IncompatibleCpuAbiException e:
            return "ADB0020";
        // ... rest unchanged
    }
}

Error codes list — remove lines 1007–1009:

static readonly List<(string code, string message)> error_codes = new List<(string code , string message)> () {
    { (code: "ADB0010", message: nameof (InstallFailedException)) },
    { (code: "ADB0020", message: nameof (IncompatibleCpuAbiException)) },
    // ... rest unchanged
};

Guidelines

  • Preserve existing formatting (tabs, Mono style)
  • Do not remove the IncompatibleCpuAbiExceptiopn class declaration itself (in src/Mono.AndroidTools/AdbException.cs) — that is an intentional [Obsolete] declaration kept for binary compatibility
  • Only remove the usages of the obsolete type in FastDeploy.cs

Acceptance Criteria

  • The four #pragma warning disable/restore CS0618 lines around IncompatibleCpuAbiExceptiopn in FastDeploy.cs are removed
  • The case IncompatibleCpuAbiExceptiopn e: branch is removed from GetErrorCode(Exception)
  • The nameof(IncompatibleCpuAbiExceptiopn) entry is removed from error_codes
  • The using directive for the obsolete type is removed if it becomes unused
  • All tests pass
  • No new warnings introduced

Fix-finder metadata

  • Script: 02-obsolete-api-usage
  • Score: 27/30 (actionability: 10, safety: 8, scope: 9)

Generated by Nightly Fix Finder · ● 27.6M ·

  • expires on Jun 14, 2026, 2:32 AM 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