Remove the obsolete AndroidClientHandler class#11393
Conversation
There was a problem hiding this comment.
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
CheckClientHandlerTypetask,XA1031/1032/1033resources/docs,HttpClientHandlerTypetask properties,XA_HTTP_CLIENT_HANDLER_TYPEenv injection,AndroidEnvironment.GetHttpMessageHandlerselection logic, and related tests. - Refactor
_CheckAndroidHttpClientHandlerTypetarget to emit an MSBuild<Error/>when the property is set; add cross-scheme redirect handling inAndroidMessageHandler; splitHttpClientIntegrationTestsinto a singleAndroidMessageHandlerIntegrationTestsfixture.
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
| 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); |
There was a problem hiding this comment.
I guess this is saying that the redirect could be a relative URL and the scheme could be blank?
| 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." /> |
There was a problem hiding this comment.
Needs to url encode the dollar sign in $(UseNativeHttpHandler).
This PR removes the obsolete AndroidClientHandler class and leaves just the AndroidMessageHandler class as the native http handler. The
$(AndroidHttpClientHandlerType)property and theXA_HTTP_CLIENT_HANDLER_TYPEenvironment variable are now ignored.