diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs index bdca584723a2ea..e0d9a3c2e42964 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs @@ -969,6 +969,12 @@ public void AllSocketsHttpHandlerCounters_Success_Recorded() { RemoteExecutor.Invoke(static async Task () => { + if (PlatformDetection.IsMobile) + { + // Force the test to use SocketsHttpHandler + AppContext.SetSwitch("System.Net.Http.UseNativeHttpHandler", false); + } + TaskCompletionSource clientWaitingTcs = new(TaskCreationOptions.RunContinuationsAsynchronously); using HttpMetricsTest_DefaultMeter test = new(null);