[Tests] Remove dead GetInnerHandlerType helper - #11665
Merged
jonathanpeppers merged 1 commit intoJun 16, 2026
Merged
Conversation
AndroidHandlerTestBase.GetInnerHandlerType is a private static helper with zero
callers (confirmed via find-references) — dead code. It also reflected into BCL
private fields (HttpMessageInvoker._handler / _delegatingHandler) and had a buggy
copy-paste assertion (it null-checked handlerField twice instead of checking
innerHandlerField), all guarded by an [UnconditionalSuppressMessage("Trimming",
"IL2075")].
Delete the method, its suppression, and the now-unused System.Reflection /
System.Diagnostics.CodeAnalysis usings.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes an unused private test helper (AndroidHandlerTestBase.GetInnerHandlerType) from the Mono.Android test suite. This helps the ongoing effort to reduce trimming/AOT-warning suppressions by deleting unreachable reflection code and its associated [UnconditionalSuppressMessage].
Changes:
- Deleted the dead
GetInnerHandlerType (HttpClient)helper (no callers). - Removed the now-unneeded
[UnconditionalSuppressMessage ("Trimming", "IL2075")]. - Dropped unused
using System.Reflection;andusing System.Diagnostics.CodeAnalysis;.
Show a summary per file
| File | Description |
|---|---|
| tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidHandlerTestBase.cs | Removes unreachable reflection-based helper and related trimming suppression + unused usings. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jonathanpeppers
approved these changes
Jun 16, 2026
jonathanpeppers
deleted the
dev/simonrozsival/remove-dead-getinnerhandlertype
branch
June 16, 2026 13:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
AndroidHandlerTestBase.GetInnerHandlerTypeis a privatestatictest helper with zero callers (confirmed via find-references — it appears only at its own declaration). It is dead code.When did it become dead? Its last caller was removed by #6678 ("[Mono.Android-Tests] Stop using tls-test.internalx.com", merged 2022-01-28), which deleted the TLS handler tests whose
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (c).Name, …)assertion was the only thing using it. It has been unused ever since.It also:
HttpMessageInvoker._handler/_delegatingHandler), which is fragile across runtime versions, andhandlerFieldtwice instead ofinnerHandlerField),[UnconditionalSuppressMessage ("Trimming", "IL2075")].Since the method is unreachable, this removes:
[UnconditionalSuppressMessage],using System.Reflection;andusing System.Diagnostics.CodeAnalysis;.Why
Contributes to #10794 ("[TrimmableTypeMap] Address all trimming and AOT warnings", which includes "No
[UnconditionalSuppressMessage]used in the dotnet/android repo") by removing one more[UnconditionalSuppressMessage]— here the cleanest fix is simply deleting the dead code rather than annotating it.No behavioral change: the method has been unreachable since #6678.