[release/6.0] Add System.Net.Http ServerCertificateCustomValidationCallback ILLink...
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Wed, 8 Sep 2021 07:15:46 +0000 (09:15 +0200)
committerGitHub <noreply@github.com>
Wed, 8 Sep 2021 07:15:46 +0000 (09:15 +0200)
Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml
src/libraries/System.Net.Http/src/System.Net.Http.csproj
src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.Android.cs [deleted file]
src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs [moved from src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.MacCatalyst.cs with 82% similarity]
src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs
src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.iOS.cs [deleted file]
src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.tvOS.cs [deleted file]

index a6af29a..d6f428f 100644 (file)
       <argument>ILLink</argument>
       <argument>IL2035</argument>
       <property name="Scope">member</property>
+      <property name="Target">M:System.Net.Http.HttpClientHandler.GetServerCertificateCustomValidationCallback</property>
+    </attribute>
+    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+      <argument>ILLink</argument>
+      <argument>IL2035</argument>
+      <property name="Scope">member</property>
+      <property name="Target">M:System.Net.Http.HttpClientHandler.SetServerCertificateCustomValidationCallback(System.Func{System.Net.Http.HttpRequestMessage,System.Security.Cryptography.X509Certificates.X509Certificate2,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors,System.Boolean})</property>
+    </attribute>
+    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+      <argument>ILLink</argument>
+      <argument>IL2035</argument>
+      <property name="Scope">member</property>
       <property name="Target">M:System.Net.Http.HttpClientHandler.GetCheckCertificateRevocationList()</property>
       <property name="Justification">The Xamarin.iOS and Mono.Android libraries are not present when running the trimmer analysis during our build. A consuming application will get a warning if these libraries aren't present when trimming the full app.</property>
     </attribute>
index 28de4bb..f6bcf3f 100644 (file)
   <PropertyGroup Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsTVOS)' == 'true'">
     <DefineConstants>$(DefineConstants);TARGET_MOBILE</DefineConstants>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(TargetsAndroid)' == 'true'">
+    <DefineConstants>$(DefineConstants);TARGET_ANDROID</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(TargetsiOS)' == 'true'">
+    <DefineConstants>$(DefineConstants);TARGET_IOS</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(TargetsMacCatalyst)' == 'true'">
+    <DefineConstants>$(DefineConstants);TARGET_MACCATALYST</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(TargetsTVOS)' == 'true'">
+    <DefineConstants>$(DefineConstants);TARGET_TVOS</DefineConstants>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(TargetsBrowser)' == 'true'">
     <DefineConstants>$(DefineConstants);TARGET_BROWSER</DefineConstants>
   </PropertyGroup>
     <Compile Include="System\Net\Http\HttpClient.cs" />
     <Compile Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsTVOS)' == 'true'"
              Include="System\Net\Http\HttpClientHandler.AnyMobile.cs" />
-    <Compile Condition="'$(TargetsiOS)' == 'true'" Include="System\Net\Http\HttpClientHandler.iOS.cs" />
-    <Compile Condition="'$(TargetsMacCatalyst)' == 'true'" Include="System\Net\Http\HttpClientHandler.MacCatalyst.cs" />
-    <Compile Condition="'$(TargetsTVOS)' == 'true'" Include="System\Net\Http\HttpClientHandler.tvOS.cs" />
-    <Compile Condition="'$(TargetsAndroid)' == 'true'" Include="System\Net\Http\HttpClientHandler.Android.cs" />
+    <Compile Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsTVOS)' == 'true'"
+             Include="System\Net\Http\HttpClientHandler.AnyMobile.InvokeNativeHandler.cs" />
     <Compile Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetsMacCatalyst)' != 'true' and '$(TargetsTVOS)' != 'true'"
              Include="System\Net\Http\HttpClientHandler.cs" />
     <Compile Include="System\Net\Http\HttpCompletionOption.cs" />
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.Android.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.Android.cs
deleted file mode 100644 (file)
index 95face9..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Net.Security;
-using System.Reflection;
-using System.Runtime.Versioning;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net.Http
-{
-    public partial class HttpClientHandler : HttpMessageHandler
-    {
-        private static MethodInfo? _nativeHandlerMethod;
-
-        private const string NativeHandlerType = "Xamarin.Android.Net.AndroidMessageHandler";
-        private const string AssemblyName = "Mono.Android";
-
-        [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)]
-        private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials");
-
-        [DynamicDependency("set_DefaultProxyCredentials", NativeHandlerType, AssemblyName)]
-        private void SetDefaultProxyCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_DefaultProxyCredentials", value);
-
-        [DynamicDependency("get_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)]
-        private int GetMaxConnectionsPerServer() => (int)InvokeNativeHandlerMethod("get_MaxConnectionsPerServer");
-
-        [DynamicDependency("set_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)]
-        private void SetMaxConnectionsPerServer(int value) => InvokeNativeHandlerMethod("set_MaxConnectionsPerServer", value);
-
-        [DynamicDependency("get_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)]
-        private int GetMaxResponseHeadersLength() => (int)InvokeNativeHandlerMethod("get_MaxResponseHeadersLength");
-
-        [DynamicDependency("set_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)]
-        private void SetMaxResponseHeadersLength(int value) => InvokeNativeHandlerMethod("set_MaxResponseHeadersLength", value);
-
-        [DynamicDependency("get_ClientCertificateOptions", NativeHandlerType, AssemblyName)]
-        private ClientCertificateOption GetClientCertificateOptions() => (ClientCertificateOption)InvokeNativeHandlerMethod("get_ClientCertificateOptions");
-
-        [DynamicDependency("set_ClientCertificateOptions", NativeHandlerType, AssemblyName)]
-        private void SetClientCertificateOptions(ClientCertificateOption value) => InvokeNativeHandlerMethod("set_ClientCertificateOptions", value);
-
-        [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)]
-        private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates");
-
-        [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
-        private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList");
-
-        [DynamicDependency("set_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
-        private void SetCheckCertificateRevocationList(bool value) => InvokeNativeHandlerMethod("set_CheckCertificateRevocationList", value);
-
-        [DynamicDependency("get_SslProtocols", NativeHandlerType, AssemblyName)]
-        private SslProtocols GetSslProtocols() => (SslProtocols)InvokeNativeHandlerMethod("get_SslProtocols");
-
-        [DynamicDependency("set_SslProtocols", NativeHandlerType, AssemblyName)]
-        private void SetSslProtocols(SslProtocols value) => InvokeNativeHandlerMethod("set_SslProtocols", value);
-
-        [DynamicDependency("get_Properties", NativeHandlerType, AssemblyName)]
-        private IDictionary<string, object?> GetProperties() => (IDictionary<string, object?>)InvokeNativeHandlerMethod("get_Properties");
-
-        [DynamicDependency("get_SupportsAutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsAutomaticDecompression() => (bool)InvokeNativeHandlerMethod("get_SupportsAutomaticDecompression");
-
-        [DynamicDependency("get_SupportsProxy", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsProxy() => (bool)InvokeNativeHandlerMethod("get_SupportsProxy");
-
-        [DynamicDependency("get_SupportsRedirectConfiguration", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsRedirectConfiguration() => (bool)InvokeNativeHandlerMethod("get_SupportsRedirectConfiguration");
-
-        [DynamicDependency("get_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)]
-        private int GetMaxAutomaticRedirections() => (int)InvokeNativeHandlerMethod("get_MaxAutomaticRedirections");
-
-        [DynamicDependency("set_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)]
-        private void SetMaxAutomaticRedirections(int value) => InvokeNativeHandlerMethod("set_MaxAutomaticRedirections", value);
-
-        [DynamicDependency("get_PreAuthenticate", NativeHandlerType, AssemblyName)]
-        private bool GetPreAuthenticate() => (bool)InvokeNativeHandlerMethod("get_PreAuthenticate");
-
-        [DynamicDependency("set_PreAuthenticate", NativeHandlerType, AssemblyName)]
-        private void SetPreAuthenticate(bool value) => InvokeNativeHandlerMethod("set_PreAuthenticate", value);
-
-        [DynamicDependency("get_UseProxy", NativeHandlerType, AssemblyName)]
-        private bool GetUseProxy() => (bool)InvokeNativeHandlerMethod("get_UseProxy");
-
-        [DynamicDependency("set_UseProxy", NativeHandlerType, AssemblyName)]
-        private void SetUseProxy(bool value) => InvokeNativeHandlerMethod("set_UseProxy", value);
-
-        [DynamicDependency("get_Proxy", NativeHandlerType, AssemblyName)]
-        private IWebProxy GetProxy() => (IWebProxy)InvokeNativeHandlerMethod("get_Proxy");
-
-        [DynamicDependency("set_Proxy", NativeHandlerType, AssemblyName)]
-        private void SetProxy(IWebProxy value) => InvokeNativeHandlerMethod("set_Proxy", value);
-
-        [DynamicDependency("get_AutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private DecompressionMethods GetAutomaticDecompression() => (DecompressionMethods)InvokeNativeHandlerMethod("get_AutomaticDecompression");
-
-        [DynamicDependency("set_AutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private void SetAutomaticDecompression(DecompressionMethods value) => InvokeNativeHandlerMethod("set_AutomaticDecompression", value);
-
-        [DynamicDependency("get_UseCookies", NativeHandlerType, AssemblyName)]
-        private bool GetUseCookies() => (bool)InvokeNativeHandlerMethod("get_UseCookies");
-
-        [DynamicDependency("set_UseCookies", NativeHandlerType, AssemblyName)]
-        private void SetUseCookies(bool value) => InvokeNativeHandlerMethod("set_UseCookies", value);
-
-        [DynamicDependency("get_CookieContainer", NativeHandlerType, AssemblyName)]
-        private CookieContainer GetCookieContainer() => (CookieContainer)InvokeNativeHandlerMethod("get_CookieContainer");
-
-        [DynamicDependency("set_CookieContainer", NativeHandlerType, AssemblyName)]
-        private void SetCookieContainer(CookieContainer value) => InvokeNativeHandlerMethod("set_CookieContainer", value);
-
-        [DynamicDependency("get_AllowAutoRedirect", NativeHandlerType, AssemblyName)]
-        private bool GetAllowAutoRedirect() => (bool)InvokeNativeHandlerMethod("get_AllowAutoRedirect");
-
-        [DynamicDependency("set_AllowAutoRedirect", NativeHandlerType, AssemblyName)]
-        private void SetAllowAutoRedirect(bool value) => InvokeNativeHandlerMethod("set_AllowAutoRedirect", value);
-
-        [DynamicDependency("get_Credentials", NativeHandlerType, AssemblyName)]
-        private ICredentials GetCredentials() => (ICredentials)InvokeNativeHandlerMethod("get_Credentials");
-
-        [DynamicDependency("set_Credentials", NativeHandlerType, AssemblyName)]
-        private void SetCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_Credentials", value);
-
-        private HttpMessageHandler CreateNativeHandler()
-        {
-            if (_nativeHandlerMethod == null)
-            {
-                Type? androidEnv = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android");
-                _nativeHandlerMethod = androidEnv!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
-            }
-
-            return (HttpMessageHandler)_nativeHandlerMethod!.Invoke(null, null)!;
-        }
-    }
-}
\ No newline at end of file
@@ -15,8 +15,25 @@ namespace System.Net.Http
     {
         private static MethodInfo? _nativeHandlerMethod;
 
+#if TARGET_ANDROID
+        private const string NativeHandlerType = "Xamarin.Android.Net.AndroidMessageHandler";
+        private const string AssemblyName = "Mono.Android";
+        private const string GetHttpMessageHandlerType = "Android.Runtime.AndroidEnvironment, Mono.Android";
+#elif TARGET_IOS
+        private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler";
+        private const string AssemblyName = "Xamarin.iOS";
+        private const string GetHttpMessageHandlerType = "ObjCRuntime.RuntimeOptions, Xamarin.iOS";
+#elif TARGET_MACCATALYST
         private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler";
         private const string AssemblyName = "Xamarin.MacCatalyst";
+        private const string GetHttpMessageHandlerType = "ObjCRuntime.RuntimeOptions, Xamarin.MacCatalyst";
+#elif TARGET_TVOS
+        private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler";
+        private const string AssemblyName = "Xamarin.TVOS";
+        private const string GetHttpMessageHandlerType = "ObjCRuntime.RuntimeOptions, Xamarin.TVOS";
+#else
+#error Unknown target
+#endif
 
         [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)]
         private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials");
@@ -45,6 +62,12 @@ namespace System.Net.Http
         [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)]
         private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates");
 
+        [DynamicDependency("get_ServerCertificateCustomValidationCallback", NativeHandlerType, AssemblyName)]
+        private Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool> GetServerCertificateCustomValidationCallback() => (Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool>)InvokeNativeHandlerMethod("get_ServerCertificateCustomValidationCallback");
+
+        [DynamicDependency("set_ServerCertificateCustomValidationCallback", NativeHandlerType, AssemblyName)]
+        private void SetServerCertificateCustomValidationCallback(Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool>? value) => InvokeNativeHandlerMethod("set_ServerCertificateCustomValidationCallback", value);
+
         [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
         private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList");
 
@@ -127,7 +150,7 @@ namespace System.Net.Http
         {
             if (_nativeHandlerMethod == null)
             {
-                Type? runtimeOptions = Type.GetType("ObjCRuntime.RuntimeOptions, Xamarin.MacCatalyst");
+                Type? runtimeOptions = Type.GetType(GetHttpMessageHandlerType);
                 _nativeHandlerMethod = runtimeOptions!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
             }
 
index e6168b4..2284b33 100644 (file)
@@ -426,7 +426,7 @@ namespace System.Net.Http
             {
                 if (IsNativeHandlerEnabled)
                 {
-                    throw new PlatformNotSupportedException();
+                    return GetServerCertificateCustomValidationCallback();
                 }
                 else
                 {
@@ -437,7 +437,7 @@ namespace System.Net.Http
             {
                 if (IsNativeHandlerEnabled)
                 {
-                    throw new PlatformNotSupportedException();
+                    SetServerCertificateCustomValidationCallback(value);
                 }
                 else
                 {
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.iOS.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.iOS.cs
deleted file mode 100644 (file)
index 915c1c9..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Net.Security;
-using System.Reflection;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net.Http
-{
-    public partial class HttpClientHandler : HttpMessageHandler
-    {
-        private static MethodInfo? _nativeHandlerMethod;
-
-        private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler";
-        private const string AssemblyName = "Xamarin.iOS";
-
-        [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)]
-        private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials");
-
-        [DynamicDependency("set_DefaultProxyCredentials", NativeHandlerType, AssemblyName)]
-        private void SetDefaultProxyCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_DefaultProxyCredentials", value);
-
-        [DynamicDependency("get_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)]
-        private int GetMaxConnectionsPerServer() => (int)InvokeNativeHandlerMethod("get_MaxConnectionsPerServer");
-
-        [DynamicDependency("set_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)]
-        private void SetMaxConnectionsPerServer(int value) => InvokeNativeHandlerMethod("set_MaxConnectionsPerServer", value);
-
-        [DynamicDependency("get_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)]
-        private int GetMaxResponseHeadersLength() => (int)InvokeNativeHandlerMethod("get_MaxResponseHeadersLength");
-
-        [DynamicDependency("set_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)]
-        private void SetMaxResponseHeadersLength(int value) => InvokeNativeHandlerMethod("set_MaxResponseHeadersLength", value);
-
-        [DynamicDependency("get_ClientCertificateOptions", NativeHandlerType, AssemblyName)]
-        private ClientCertificateOption GetClientCertificateOptions() => (ClientCertificateOption)InvokeNativeHandlerMethod("get_ClientCertificateOptions");
-
-        [DynamicDependency("set_ClientCertificateOptions", NativeHandlerType, AssemblyName)]
-        private void SetClientCertificateOptions(ClientCertificateOption value) => InvokeNativeHandlerMethod("set_ClientCertificateOptions", value);
-
-        [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)]
-        private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates");
-
-        [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
-        private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList");
-
-        [DynamicDependency("set_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
-        private void SetCheckCertificateRevocationList(bool value) => InvokeNativeHandlerMethod("set_CheckCertificateRevocationList", value);
-
-        [DynamicDependency("get_SslProtocols", NativeHandlerType, AssemblyName)]
-        private SslProtocols GetSslProtocols() => (SslProtocols)InvokeNativeHandlerMethod("get_SslProtocols");
-
-        [DynamicDependency("set_SslProtocols", NativeHandlerType, AssemblyName)]
-        private void SetSslProtocols(SslProtocols value) => InvokeNativeHandlerMethod("set_SslProtocols", value);
-
-        [DynamicDependency("get_Properties", NativeHandlerType, AssemblyName)]
-        private IDictionary<string, object?> GetProperties() => (IDictionary<string, object?>)InvokeNativeHandlerMethod("get_Properties");
-
-        [DynamicDependency("get_SupportsAutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsAutomaticDecompression() => (bool)InvokeNativeHandlerMethod("get_SupportsAutomaticDecompression");
-
-        [DynamicDependency("get_SupportsProxy", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsProxy() => (bool)InvokeNativeHandlerMethod("get_SupportsProxy");
-
-        [DynamicDependency("get_AutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private DecompressionMethods GetAutomaticDecompression() => (DecompressionMethods)InvokeNativeHandlerMethod("get_AutomaticDecompression");
-
-        [DynamicDependency("set_AutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private void SetAutomaticDecompression(DecompressionMethods value) => InvokeNativeHandlerMethod("set_AutomaticDecompression", value);
-
-        [DynamicDependency("get_UseProxy", NativeHandlerType, AssemblyName)]
-        private bool GetUseProxy() => (bool)InvokeNativeHandlerMethod("get_UseProxy");
-
-        [DynamicDependency("set_UseProxy", NativeHandlerType, AssemblyName)]
-        private void SetUseProxy(bool value) => InvokeNativeHandlerMethod("set_UseProxy", value);
-
-        [DynamicDependency("get_Proxy", NativeHandlerType, AssemblyName)]
-        private IWebProxy GetProxy() => (IWebProxy)InvokeNativeHandlerMethod("get_Proxy");
-
-        [DynamicDependency("set_Proxy", NativeHandlerType, AssemblyName)]
-        private void SetProxy(IWebProxy value) => InvokeNativeHandlerMethod("set_Proxy", value);
-
-        [DynamicDependency("get_PreAuthenticate", NativeHandlerType, AssemblyName)]
-        private bool GetPreAuthenticate() => (bool)InvokeNativeHandlerMethod("get_PreAuthenticate");
-
-        [DynamicDependency("set_PreAuthenticate", NativeHandlerType, AssemblyName)]
-        private void SetPreAuthenticate(bool value) => InvokeNativeHandlerMethod("set_PreAuthenticate", value);
-
-        [DynamicDependency("get_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)]
-        private int GetMaxAutomaticRedirections() => (int)InvokeNativeHandlerMethod("get_MaxAutomaticRedirections");
-
-        [DynamicDependency("set_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)]
-        private void SetMaxAutomaticRedirections(int value) => InvokeNativeHandlerMethod("set_MaxAutomaticRedirections", value);
-
-        [DynamicDependency("get_UseCookies", NativeHandlerType, AssemblyName)]
-        private bool GetUseCookies() => (bool)InvokeNativeHandlerMethod("get_UseCookies");
-
-        [DynamicDependency("get_SupportsRedirectConfiguration", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsRedirectConfiguration() => (bool)InvokeNativeHandlerMethod("get_SupportsRedirectConfiguration");
-
-        [DynamicDependency("set_UseCookies", NativeHandlerType, AssemblyName)]
-        private void SetUseCookies(bool value) => InvokeNativeHandlerMethod("set_UseCookies", value);
-
-        [DynamicDependency("get_CookieContainer", NativeHandlerType, AssemblyName)]
-        private CookieContainer GetCookieContainer() => (CookieContainer)InvokeNativeHandlerMethod("get_CookieContainer");
-
-        [DynamicDependency("set_CookieContainer", NativeHandlerType, AssemblyName)]
-        private void SetCookieContainer(CookieContainer value) => InvokeNativeHandlerMethod("set_CookieContainer", value);
-
-        [DynamicDependency("get_AllowAutoRedirect", NativeHandlerType, AssemblyName)]
-        private bool GetAllowAutoRedirect() => (bool)InvokeNativeHandlerMethod("get_AllowAutoRedirect");
-
-        [DynamicDependency("set_AllowAutoRedirect", NativeHandlerType, AssemblyName)]
-        private void SetAllowAutoRedirect(bool value) => InvokeNativeHandlerMethod("set_AllowAutoRedirect", value);
-
-        [DynamicDependency("get_Credentials", NativeHandlerType, AssemblyName)]
-        private ICredentials GetCredentials() => (ICredentials)InvokeNativeHandlerMethod("get_Credentials");
-
-        [DynamicDependency("set_Credentials", NativeHandlerType, AssemblyName)]
-        private void SetCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_Credentials", value);
-
-        private HttpMessageHandler CreateNativeHandler()
-        {
-            if (_nativeHandlerMethod == null)
-            {
-                Type? runtimeOptions = Type.GetType("ObjCRuntime.RuntimeOptions, Xamarin.iOS");
-                _nativeHandlerMethod = runtimeOptions!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
-            }
-
-            return (HttpMessageHandler)_nativeHandlerMethod!.Invoke(null, null)!;
-        }
-    }
-}
\ No newline at end of file
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.tvOS.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.tvOS.cs
deleted file mode 100644 (file)
index 8add42b..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Net.Security;
-using System.Reflection;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net.Http
-{
-    public partial class HttpClientHandler : HttpMessageHandler
-    {
-        private static MethodInfo? _nativeHandlerMethod;
-
-        private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler";
-        private const string AssemblyName = "Xamarin.TVOS";
-
-        [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)]
-        private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials");
-
-        [DynamicDependency("set_DefaultProxyCredentials", NativeHandlerType, AssemblyName)]
-        private void SetDefaultProxyCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_DefaultProxyCredentials", value);
-
-        [DynamicDependency("get_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)]
-        private int GetMaxConnectionsPerServer() => (int)InvokeNativeHandlerMethod("get_MaxConnectionsPerServer");
-
-        [DynamicDependency("set_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)]
-        private void SetMaxConnectionsPerServer(int value) => InvokeNativeHandlerMethod("set_MaxConnectionsPerServer", value);
-
-        [DynamicDependency("get_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)]
-        private int GetMaxResponseHeadersLength() => (int)InvokeNativeHandlerMethod("get_MaxResponseHeadersLength");
-
-        [DynamicDependency("set_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)]
-        private void SetMaxResponseHeadersLength(int value) => InvokeNativeHandlerMethod("set_MaxResponseHeadersLength", value);
-
-        [DynamicDependency("get_ClientCertificateOptions", NativeHandlerType, AssemblyName)]
-        private ClientCertificateOption GetClientCertificateOptions() => (ClientCertificateOption)InvokeNativeHandlerMethod("get_ClientCertificateOptions");
-
-        [DynamicDependency("set_ClientCertificateOptions", NativeHandlerType, AssemblyName)]
-        private void SetClientCertificateOptions(ClientCertificateOption value) => InvokeNativeHandlerMethod("set_ClientCertificateOptions", value);
-
-        [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)]
-        private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates");
-
-        [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
-        private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList");
-
-        [DynamicDependency("set_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
-        private void SetCheckCertificateRevocationList(bool value) => InvokeNativeHandlerMethod("set_CheckCertificateRevocationList", value);
-
-        [DynamicDependency("get_SslProtocols", NativeHandlerType, AssemblyName)]
-        private SslProtocols GetSslProtocols() => (SslProtocols)InvokeNativeHandlerMethod("get_SslProtocols");
-
-        [DynamicDependency("set_SslProtocols", NativeHandlerType, AssemblyName)]
-        private void SetSslProtocols(SslProtocols value) => InvokeNativeHandlerMethod("set_SslProtocols", value);
-
-        [DynamicDependency("get_Properties", NativeHandlerType, AssemblyName)]
-        private IDictionary<string, object?> GetProperties() => (IDictionary<string, object?>)InvokeNativeHandlerMethod("get_Properties");
-
-        [DynamicDependency("get_SupportsAutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsAutomaticDecompression() => (bool)InvokeNativeHandlerMethod("get_SupportsAutomaticDecompression");
-
-        [DynamicDependency("get_SupportsProxy", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsProxy() => (bool)InvokeNativeHandlerMethod("get_SupportsProxy");
-
-        [DynamicDependency("get_SupportsRedirectConfiguration", NativeHandlerType, AssemblyName)]
-        private bool GetSupportsRedirectConfiguration() => (bool)InvokeNativeHandlerMethod("get_SupportsRedirectConfiguration");
-
-        [DynamicDependency("get_AutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private DecompressionMethods GetAutomaticDecompression() => (DecompressionMethods)InvokeNativeHandlerMethod("get_AutomaticDecompression");
-
-        [DynamicDependency("set_AutomaticDecompression", NativeHandlerType, AssemblyName)]
-        private void SetAutomaticDecompression(DecompressionMethods value) => InvokeNativeHandlerMethod("set_AutomaticDecompression", value);
-
-        [DynamicDependency("get_UseProxy", NativeHandlerType, AssemblyName)]
-        private bool GetUseProxy() => (bool)InvokeNativeHandlerMethod("get_UseProxy");
-
-        [DynamicDependency("set_UseProxy", NativeHandlerType, AssemblyName)]
-        private void SetUseProxy(bool value) => InvokeNativeHandlerMethod("set_UseProxy", value);
-
-        [DynamicDependency("get_Proxy", NativeHandlerType, AssemblyName)]
-        private IWebProxy GetProxy() => (IWebProxy)InvokeNativeHandlerMethod("get_Proxy");
-
-        [DynamicDependency("set_Proxy", NativeHandlerType, AssemblyName)]
-        private void SetProxy(IWebProxy value) => InvokeNativeHandlerMethod("set_Proxy", value);
-
-        [DynamicDependency("get_PreAuthenticate", NativeHandlerType, AssemblyName)]
-        private bool GetPreAuthenticate() => (bool)InvokeNativeHandlerMethod("get_PreAuthenticate");
-
-        [DynamicDependency("set_PreAuthenticate", NativeHandlerType, AssemblyName)]
-        private void SetPreAuthenticate(bool value) => InvokeNativeHandlerMethod("set_PreAuthenticate", value);
-
-        [DynamicDependency("get_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)]
-        private int GetMaxAutomaticRedirections() => (int)InvokeNativeHandlerMethod("get_MaxAutomaticRedirections");
-
-        [DynamicDependency("set_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)]
-        private void SetMaxAutomaticRedirections(int value) => InvokeNativeHandlerMethod("set_MaxAutomaticRedirections", value);
-
-        [DynamicDependency("get_UseCookies", NativeHandlerType, AssemblyName)]
-        private bool GetUseCookies() => (bool)InvokeNativeHandlerMethod("get_UseCookies");
-
-        [DynamicDependency("set_UseCookies", NativeHandlerType, AssemblyName)]
-        private void SetUseCookies(bool value) => InvokeNativeHandlerMethod("set_UseCookies", value);
-
-        [DynamicDependency("get_CookieContainer", NativeHandlerType, AssemblyName)]
-        private CookieContainer GetCookieContainer() => (CookieContainer)InvokeNativeHandlerMethod("get_CookieContainer");
-
-        [DynamicDependency("set_CookieContainer", NativeHandlerType, AssemblyName)]
-        private void SetCookieContainer(CookieContainer value) => InvokeNativeHandlerMethod("set_CookieContainer", value);
-
-        [DynamicDependency("get_AllowAutoRedirect", NativeHandlerType, AssemblyName)]
-        private bool GetAllowAutoRedirect() => (bool)InvokeNativeHandlerMethod("get_AllowAutoRedirect");
-
-        [DynamicDependency("set_AllowAutoRedirect", NativeHandlerType, AssemblyName)]
-        private void SetAllowAutoRedirect(bool value) => InvokeNativeHandlerMethod("set_AllowAutoRedirect", value);
-
-        [DynamicDependency("get_Credentials", NativeHandlerType, AssemblyName)]
-        private ICredentials GetCredentials() => (ICredentials)InvokeNativeHandlerMethod("get_Credentials");
-
-        [DynamicDependency("set_Credentials", NativeHandlerType, AssemblyName)]
-        private void SetCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_Credentials", value);
-
-        private HttpMessageHandler CreateNativeHandler()
-        {
-            if (_nativeHandlerMethod == null)
-            {
-                Type? runtimeOptions = Type.GetType("ObjCRuntime.RuntimeOptions, Xamarin.TVOS");
-                _nativeHandlerMethod = runtimeOptions!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
-            }
-
-            return (HttpMessageHandler)_nativeHandlerMethod!.Invoke(null, null)!;
-        }
-    }
-}
\ No newline at end of file