diff --git a/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml b/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml
index a6af29a8085c3e..d6f428f20d4e6d 100644
--- a/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml
+++ b/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml
@@ -141,6 +141,18 @@
M:System.Net.Http.HttpClientHandler.SetMaxAutomaticRedirections(System.Int32)
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.
+
+ ILLink
+ IL2035
+ member
+ M:System.Net.Http.HttpClientHandler.GetServerCertificateCustomValidationCallback
+
+
+ ILLink
+ IL2035
+ member
+ 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})
+
ILLink
IL2035
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs
index bdee654723937c..724e00b571556f 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs
@@ -62,6 +62,12 @@ public partial class HttpClientHandler : HttpMessageHandler
[DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)]
private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates");
+ [DynamicDependency("get_ServerCertificateCustomValidationCallback", NativeHandlerType, AssemblyName)]
+ private Func GetServerCertificateCustomValidationCallback() => (Func)InvokeNativeHandlerMethod("get_ServerCertificateCustomValidationCallback");
+
+ [DynamicDependency("set_ServerCertificateCustomValidationCallback", NativeHandlerType, AssemblyName)]
+ private void SetServerCertificateCustomValidationCallback(Func? value) => InvokeNativeHandlerMethod("set_ServerCertificateCustomValidationCallback", value);
+
[DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)]
private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList");
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs
index e6168b48190ba6..2284b33b80a719 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs
@@ -426,7 +426,7 @@ public X509CertificateCollection ClientCertificates
{
if (IsNativeHandlerEnabled)
{
- throw new PlatformNotSupportedException();
+ return GetServerCertificateCustomValidationCallback();
}
else
{
@@ -437,7 +437,7 @@ public X509CertificateCollection ClientCertificates
{
if (IsNativeHandlerEnabled)
{
- throw new PlatformNotSupportedException();
+ SetServerCertificateCustomValidationCallback(value);
}
else
{