Skip to content

Remove the obsolete AndroidClientHandler class#11393

Open
simonrozsival wants to merge 3 commits into
mainfrom
dev/srozsival/remove-obsolete-android-client-handler
Open

Remove the obsolete AndroidClientHandler class#11393
simonrozsival wants to merge 3 commits into
mainfrom
dev/srozsival/remove-obsolete-android-client-handler

Conversation

@simonrozsival
Copy link
Copy Markdown
Member

This PR removes the obsolete AndroidClientHandler class and leaves just the AndroidMessageHandler class as the native http handler. The $(AndroidHttpClientHandlerType) property and the XA_HTTP_CLIENT_HANDLER_TYPE environment variable are now ignored.

Copilot AI review requested due to automatic review settings May 18, 2026 15:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the deprecated Xamarin.Android.Net.AndroidClientHandler class so only AndroidMessageHandler remains as the native HTTP handler. The $(AndroidHttpClientHandlerType) MSBuild property and the XA_HTTP_CLIENT_HANDLER_TYPE environment variable are now ignored (with the property producing a build error if set), and the related MSBuild plumbing, error codes (XA1031/XA1032/XA1033), runtime selection logic, docs, and tests are deleted. A small unrelated tweak in AndroidMessageHandler.HandleRedirect short-circuits cross-scheme redirects to let the client decide.

Changes:

  • Delete AndroidClientHandler (and its .Legacy.cs), update public API baselines on API-35/36/36.1/37, and add API-compat acceptable-breakages entries.
  • Remove CheckClientHandlerType task, XA1031/1032/1033 resources/docs, HttpClientHandlerType task properties, XA_HTTP_CLIENT_HANDLER_TYPE env injection, AndroidEnvironment.GetHttpMessageHandler selection logic, and related tests.
  • Refactor _CheckAndroidHttpClientHandlerType target to emit an MSBuild <Error/> when the property is set; add cross-scheme redirect handling in AndroidMessageHandler; split HttpClientIntegrationTests into a single AndroidMessageHandlerIntegrationTests fixture.

Reviewed changes

Copilot reviewed 44 out of 46 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs, AndroidClientHandler.Legacy.cs Delete the deprecated wrapper and its legacy implementation
src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs Drop unused *Internal shims; add cross-scheme redirect short-circuit
src/Mono.Android/Android.Runtime/AndroidEnvironment.cs Replace XA_HTTP_CLIENT_HANDLER_TYPE-based selection with a hard-coded new AndroidMessageHandler()
src/Mono.Android/Mono.Android.csproj Drop AndroidClientHandler.cs from compilation
src/Mono.Android/PublicAPI/API-3{5,6,6.1,7}/PublicAPI.{Shipped,Unshipped}.txt Move AndroidClientHandler API surface to REMOVED
src/Microsoft.Android.Sdk.ILLink/MarkJavaObjects.cs Remove custom HTTP handler preservation logic
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets Drop CheckClientHandlerType UsingTask; replace check target body with an <Error/>; stop forwarding HttpClientHandlerType
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/*.targets Drop HttpClientHandlerType parameter wiring and the default AndroidHttpClientHandlerType / UseNativeHttpHandler derivation
src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs Remove obsolete task
src/Xamarin.Android.Build.Tasks/Tasks/Generate*Sources.cs Drop HttpClientHandlerType task property and threading through AddDefaultEnvironmentVariables
src/Xamarin.Android.Build.Tasks/Utilities/Environment{Builder,FilesParser}.cs Remove AddHttpClientHandlerType/HaveHttpMessageHandler plumbing
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs Remove XA1031/XA1031_HCH/XA1032/XA1033 accessors
src/Xamarin.Android.Build.Tasks/Tests/.../CheckClientHandlerTypeTests.cs, LinkerTests.cs, EnvironmentContentTests.cs Delete tests that exercised the removed plumbing
src/profiled-aot/dotnet.aotprofile.txt Drop IsAcceptableHttpMessageHandlerType entry
tests/api-compatibility/acceptable-breakages-vReference-net11.0.txt Empty out the compat exception list (now reset to just the header)
tests/Mono.Android-Tests/.../{HttpClientIntegrationTests.cs,AndroidClientHandlerTests.cs,Android.Runtime/AndroidEnvironmentTest.cs} Remove handler-agnostic integration tests and AndroidEnvironment unit test
tests/Mono.Android-Tests/.../AndroidMessageHandlerIntegrationTests.cs New consolidated integration test fixture targeting only AndroidMessageHandler
tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj Update compile list and remove AndroidClientHandler category from exclusions
tests/Mono.Android-Tests/Mono.Android-Tests/TrimmerRoots.xml Stop preserving AndroidClientHandler
Documentation/docs-mobile/{messages/{xa1031,xa1032,xa1033}.md,index.md,TOC.yml,building-apps/build-properties.md} Remove docs for retired error codes and the AndroidHttpClientHandlerType property
.github/skills/tests/references/test-catalog.md Drop references to AndroidClientHandler test/category
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Language not supported

Comment on lines +903 to 908
if (redirectUrl.Scheme != baseUrl.Scheme) {
disposeRet = false; // let the client decide what to do next
return true;
}
if (!redirectUrl.IsAbsoluteUri)
redirectUrl = new Uri (baseUrl, location);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is saying that the redirect could be a relative URL and the scheme could be blank?

Comment on lines +481 to +482
Condition=" '$(AndroidHttpClientHandlerType)' != '' ">
<Error Text="The AndroidHttpClientHandlerType property is not supported anymore. Please remove it from your project file. Use $(UseNativeHttpHandler) with values 'true' (AndroidMessageHandler) or 'false' (SocketsHttpHandler) instead." />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to url encode the dollar sign in $(UseNativeHttpHandler).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants