Problem
src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.cs declares 16 using directives, several of which are never referenced anywhere in the file. Removing them reduces clutter and avoids misleading readers about the file's dependencies.
Location
- File(s):
src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.cs
- Line(s): 4-19 (the using block)
Current Code
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml;
using System.Xml.Linq;
using System.Text;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Xamarin.Android.Tools;
using ThreadingTasks = System.Threading.Tasks;
using Microsoft.Android.Build.Tasks;
Suggested Fix
Remove the following directives, which are confirmed unused (no type, method, extension method, or alias from them is referenced in the file):
using System.Diagnostics; — only appears in a code comment, no type usage
using System.Linq; — no LINQ extension methods used
using System.Xml; — no System.Xml types used
using System.Xml.Linq; — no X* types used
using System.Text.RegularExpressions; — the Regex.Match call is on AndroidRunToolTask.AndroidErrorRegex; the result is stored in a var, so no RegularExpressions type is named
using ThreadingTasks = System.Threading.Tasks; — the alias is never referenced
Keep all other directives (System, System.IO, System.Threading, System.Text, Microsoft.Build.*, System.Collections.Generic, System.Collections.Concurrent, Xamarin.Android.Tools, Microsoft.Android.Build.Tasks), which are all in use.
Resulting block:
using System;
using System.IO;
using System.Threading;
using System.Text;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Xamarin.Android.Tools;
using Microsoft.Android.Build.Tasks;
Guidelines
- Follow dotnet/android formatting conventions (tabs, Mono style)
- Do not reorder the remaining directives
- Verify the project still builds after removal
Acceptance Criteria
Fix-finder metadata
- Script:
06-unused-using-directives
- Score:
28/30 (actionability: 10, safety: 8, scope: 10)
Generated by Nightly Fix Finder · 73.4 AIC · ⌖ 17.5 AIC · ⊞ 9.3K · ◷
Problem
src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.csdeclares 16usingdirectives, several of which are never referenced anywhere in the file. Removing them reduces clutter and avoids misleading readers about the file's dependencies.Location
src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.csCurrent Code
Suggested Fix
Remove the following directives, which are confirmed unused (no type, method, extension method, or alias from them is referenced in the file):
using System.Diagnostics;— only appears in a code comment, no type usageusing System.Linq;— no LINQ extension methods usedusing System.Xml;— noSystem.Xmltypes usedusing System.Xml.Linq;— noX*types usedusing System.Text.RegularExpressions;— theRegex.Matchcall is onAndroidRunToolTask.AndroidErrorRegex; the result is stored in avar, so noRegularExpressionstype is namedusing ThreadingTasks = System.Threading.Tasks;— the alias is never referencedKeep all other directives (
System,System.IO,System.Threading,System.Text,Microsoft.Build.*,System.Collections.Generic,System.Collections.Concurrent,Xamarin.Android.Tools,Microsoft.Android.Build.Tasks), which are all in use.Resulting block:
Guidelines
Acceptance Criteria
Xamarin.Android.Build.Taskscompiles cleanlyFix-finder metadata
06-unused-using-directives28/30(actionability: 10, safety: 8, scope: 10)