From fee64e3ce532ddb69cfe8168b4e59ecd189ea04a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 19 Aug 2021 14:45:59 +0000 Subject: [PATCH 1/6] Update dependencies from https://github.com/dotnet/installer build 20210818.44 Microsoft.Dotnet.Sdk.Internal From Version 6.0.100-rc.1.21418.8 -> To Version 6.0.100-rc.2.21418.44 Dependency coherency updates Microsoft.NET.ILLink.Tasks,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21416.1 -> To Version 6.0.100-preview.6.21418.3 (parent: Microsoft.Dotnet.Sdk.Internal --- eng/Version.Details.xml | 10 +++++----- eng/Versions.props | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 37282c869c8..3dedeed34f6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,16 +1,16 @@ - + https://github.com/dotnet/installer - 78a1bc32ce1ec6a18d4e2b759e08de11aee37b43 + 5c2d8ef2b3e254260f7c703d8d35d2f2c5b43d97 - + https://github.com/mono/linker 5b2391c2c56af47350a5789375e8dbddc692e67f - + https://github.com/dotnet/runtime - 14b34eb02bc8969b77c0d3a1e39fb38f450625cf + 5a5d7f0518b564e7f840c6c939bb6618c778b21b diff --git a/eng/Versions.props b/eng/Versions.props index 095ae611579..460ec8a0b45 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,11 +1,11 @@ - 6.0.100-rc.1.21418.8 - 6.0.100-preview.6.21416.1 + 6.0.100-rc.2.21418.44 + 6.0.100-preview.6.21418.3 5.0.0-beta.20181.7 6.0.0-beta.21212.6 - 6.0.0-rc.1.21417.1 + 6.0.0-rc.2.21417.16 From 3818976d8c05526aca0df8ce9ed054cc246c66ab Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Thu, 19 Aug 2021 14:26:11 -0500 Subject: [PATCH 2/6] [AndroidMessageHandler] add missing Client* properties Context: https://github.com/dotnet/runtime/commit/57dd919ab81e8914b1c4ef63c4f8ee55bc79c347 With the latest changes to `HttpClientHandler`, we hit: ILLink : warning IL2037: System.Net.Http.HttpClientHandler.GetClientCertificateOptions(): No members were resolved for 'get_ClientCertificateOptions'. ILLink : warning IL2037: System.Net.Http.HttpClientHandler.GetClientCertificates(): No members were resolved for 'get_ClientCertificates'. ILLink : warning IL2037: System.Net.Http.HttpClientHandler.SetClientCertificateOptions(ClientCertificateOption): No members were resolved for 'set_ClientCertificateOptions'. We need to add the missing members that are now expected: public ClientCertificateOption ClientCertificateOptions { get; set; } public X509CertificateCollection ClientCertificates { get; set; } We can also partially revert 1e5bfa3f, because some of the issues were fixed. --- .../Xamarin.Android.Net/AndroidMessageHandler.cs | 5 +++++ .../Xamarin.Android.Net/AndroidClientHandlerTests.cs | 10 +--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs index 949b87b4618..dbe8413c4f8 100644 --- a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs +++ b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs @@ -6,6 +6,7 @@ using System.Net; using System.Net.Http; using System.Net.Http.Headers; +using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -107,6 +108,10 @@ public CookieContainer CookieContainer public bool AllowAutoRedirect { get; set; } = true; + public ClientCertificateOption ClientCertificateOptions { get; set; } + + public X509CertificateCollection ClientCertificates { get; set; } + int maxAutomaticRedirections = 50; public int MaxAutomaticRedirections diff --git a/tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs b/tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs index 9b504a033e6..c249382a315 100644 --- a/tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs +++ b/tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs @@ -88,11 +88,7 @@ public void Properties_Defaults () Assert.IsTrue (h.UseCookies, "#12"); Assert.IsFalse (h.UseDefaultCredentials, "#13"); Assert.IsTrue (h.UseProxy, "#14"); - try { - Assert.AreEqual (ClientCertificateOption.Manual, h.ClientCertificateOptions, "#15"); - } catch (PlatformNotSupportedException) { - // https://github.com/dotnet/runtime/blob/07336810acf3b4e7bdd0fb7da87b54920ea9c382/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs#L310-L314 - } + Assert.AreEqual (ClientCertificateOption.Manual, h.ClientCertificateOptions, "#15"); } [Test] @@ -103,16 +99,12 @@ public void Properties_Invalid () h.MaxAutomaticRedirections = 0; Assert.Fail ("#1"); } catch (ArgumentOutOfRangeException) { - } catch (TargetInvocationException) { - // See: https://github.com/dotnet/runtime/issues/56089 } try { h.MaxRequestContentBufferSize = -1; Assert.Fail ("#2"); } catch (ArgumentOutOfRangeException) { - } catch (TargetInvocationException) { - // See: https://github.com/dotnet/runtime/issues/56089 } } From f5122bbf0aa86e614bbeb5a00b2285258d741851 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Thu, 19 Aug 2021 17:07:07 -0500 Subject: [PATCH 3/6] More missing AndroidMessageHandler properties --- .../AndroidMessageHandler.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs index dbe8413c4f8..0764aa9299d 100644 --- a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs +++ b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs @@ -71,9 +71,9 @@ sealed class RequestRedirectionState // uncompress it any longer, doh. And they don't support 'deflate' so we need to handle it ourselves. bool decompress_here; - internal const bool SupportsAutomaticDecompression = true; - internal const bool SupportsProxy = true; - internal const bool SupportsRedirectConfiguration = true; + internal bool SupportsAutomaticDecompression => true; + internal bool SupportsProxy => true; + internal bool SupportsRedirectConfiguration => true; public DecompressionMethods AutomaticDecompression { @@ -94,7 +94,7 @@ public CookieContainer CookieContainer } // NOTE: defaults here are based on: - // https://github.com/dotnet/runtime/blob/ccfe21882e4a2206ce49cd5b32d3eb3cab3e530f/src/libraries/Common/src/System/Net/Http/HttpHandlerDefaults.cs + // https://github.com/dotnet/runtime/blob/f3b77e64b87895aa7e697f321eb6d4151a4333df/src/libraries/Common/src/System/Net/Http/HttpHandlerDefaults.cs public bool UseCookies { get; set; } = true; @@ -112,6 +112,18 @@ public CookieContainer CookieContainer public X509CertificateCollection ClientCertificates { get; set; } + public ICredentials DefaultProxyCredentials { get; set; } + + public int MaxConnectionsPerServer { get; set; } = int.MaxValue; + + public int MaxResponseHeadersLength { get; set; } = 64; // Units in K (1024) bytes. + + public bool CheckCertificateRevocationList { get; set; } = false; + + public SslProtocols SslProtocols { get; set; } = SslProtocols.Tls13 | SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; + + internal IDictionary Properties { get; set; } + int maxAutomaticRedirections = 50; public int MaxAutomaticRedirections From a3ff77d86c6b73c8f7481834889570825a003e47 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Thu, 19 Aug 2021 22:31:26 -0500 Subject: [PATCH 4/6] Missing namespace Check API level for `SslProtocols` --- .../Xamarin.Android.Net/AndroidMessageHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs index 0764aa9299d..4c86533f1c9 100644 --- a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs +++ b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs @@ -6,6 +6,7 @@ using System.Net; using System.Net.Http; using System.Net.Http.Headers; +using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; @@ -120,7 +121,10 @@ public CookieContainer CookieContainer public bool CheckCertificateRevocationList { get; set; } = false; - public SslProtocols SslProtocols { get; set; } = SslProtocols.Tls13 | SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; + // See: https://developer.android.com/reference/javax/net/ssl/SSLSocket#protocols + public SslProtocols SslProtocols { get; set; } = + (int)Build.VERSION.SdkInt >= 29 ? + SslProtocols.Tls13 | SslProtocols.Tls12 : SslProtocols.Tls12; internal IDictionary Properties { get; set; } From 5548d4962d81060e29ad92e82d9accf9045d86e7 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Thu, 19 Aug 2021 23:22:47 -0500 Subject: [PATCH 5/6] [tests] ignore NoSymbolsArgShouldReduceAppSize in .NET 6 Context: https://github.com/dotnet/runtime/issues/57800 --- .../Tests/Xamarin.Android.Build.Tests/AotTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs index 3ed2c53e192..438edc95fda 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs @@ -432,6 +432,10 @@ public static void Foo () { [Category ("LLVM")] public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string androidAotMode) { + if (Builder.UseDotNet) { + Assert.Ignore ("https://github.com/dotnet/runtime/issues/57800"); + } + AssertAotModeSupported (androidAotMode); var proj = new XamarinAndroidApplicationProject () { From 2db34403e2749b0a31197986a19668dcf27268d1 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Fri, 20 Aug 2021 09:08:50 -0500 Subject: [PATCH 6/6] All new AndroidMessageHandler properties must be public See: https://github.com/dotnet/runtime/blob/0f5b75344d5858d76da403735ee34c71d9d69d54/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs#L776 There is not any `System.Reflection.BindingFlags` specified, so it would only work for `public` members. --- .../Xamarin.Android.Net/AndroidMessageHandler.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs index 4c86533f1c9..c31b9407782 100644 --- a/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs +++ b/src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs @@ -72,9 +72,9 @@ sealed class RequestRedirectionState // uncompress it any longer, doh. And they don't support 'deflate' so we need to handle it ourselves. bool decompress_here; - internal bool SupportsAutomaticDecompression => true; - internal bool SupportsProxy => true; - internal bool SupportsRedirectConfiguration => true; + public bool SupportsAutomaticDecompression => true; + public bool SupportsProxy => true; + public bool SupportsRedirectConfiguration => true; public DecompressionMethods AutomaticDecompression { @@ -126,7 +126,7 @@ public CookieContainer CookieContainer (int)Build.VERSION.SdkInt >= 29 ? SslProtocols.Tls13 | SslProtocols.Tls12 : SslProtocols.Tls12; - internal IDictionary Properties { get; set; } + public IDictionary Properties { get; set; } int maxAutomaticRedirections = 50;