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
Fix-finder metadata
- Script:
02-obsolete-api-usage
- Score:
27/30 (actionability: 10, safety: 8, scope: 9)
Generated by Nightly Fix Finder · ● 27.6M · ◷
Problem
FastDeploy.cscontains two references to the obsoleteIncompatibleCpuAbiExceptiopnclass (note the typo: "Exceptiopn"). This exception is never thrown anywhere in the codebase — onlyIncompatibleCpuAbiException(correctly spelled) is thrown (inAdbOutputParsing.cs:319). Since the misspelled class inherits from the correctly-spelled one, the base classcasealready catches all instances. These references are dead code guarded by#pragma warning disable CS0618suppressions that should be removed.Location
src/Xamarin.Android.Build.Debugging.Tasks/Tasks/FastDeploy.csCurrent Code
Switch statement (lines 929–937):
Error codes list (lines 1005–1010):
Suggested Fix
Remove the dead-code branches and their pragma suppressions:
Switch statement — remove lines 932–935:
Error codes list — remove lines 1007–1009:
Guidelines
IncompatibleCpuAbiExceptiopnclass declaration itself (insrc/Mono.AndroidTools/AdbException.cs) — that is an intentional[Obsolete]declaration kept for binary compatibilityFastDeploy.csAcceptance Criteria
#pragma warning disable/restore CS0618lines aroundIncompatibleCpuAbiExceptiopninFastDeploy.csare removedcase IncompatibleCpuAbiExceptiopn e:branch is removed fromGetErrorCode(Exception)nameof(IncompatibleCpuAbiExceptiopn)entry is removed fromerror_codesusingdirective for the obsolete type is removed if it becomes unusedFix-finder metadata
02-obsolete-api-usage27/30(actionability:10, safety:8, scope:9)