From 431a2c899075b02afaac905f90096cf8a53777b7 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 8 Jul 2021 08:58:39 -0700 Subject: [PATCH 1/2] file --- .../src/Pipeline/ServicePointHelpers.cs | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sdk/core/Azure.Core/src/Pipeline/ServicePointHelpers.cs b/sdk/core/Azure.Core/src/Pipeline/ServicePointHelpers.cs index 7b062ab698ac..5cb0215f81db 100644 --- a/sdk/core/Azure.Core/src/Pipeline/ServicePointHelpers.cs +++ b/sdk/core/Azure.Core/src/Pipeline/ServicePointHelpers.cs @@ -57,15 +57,17 @@ public static void SetLimits(HttpMessageHandler messageHandler) return; } - switch (messageHandler) + try { - case HttpClientHandler httpClientHandler: - // Only change when the default runtime limit is used - if (httpClientHandler.MaxConnectionsPerServer == RuntimeDefaultConnectionLimit) - { - httpClientHandler.MaxConnectionsPerServer = IncreasedConnectionLimit; - } - break; + switch (messageHandler) + { + case HttpClientHandler httpClientHandler: + // Only change when the default runtime limit is used + if (httpClientHandler.MaxConnectionsPerServer == RuntimeDefaultConnectionLimit) + { + httpClientHandler.MaxConnectionsPerServer = IncreasedConnectionLimit; + } + break; #if NETCOREAPP case SocketsHttpHandler socketsHttpHandler: if (socketsHttpHandler.MaxConnectionsPerServer == RuntimeDefaultConnectionLimit) @@ -78,9 +80,15 @@ public static void SetLimits(HttpMessageHandler messageHandler) } break; #endif - default: - Debug.Assert(false, "Unknown handler type"); - break; + default: + Debug.Assert(false, "Unknown handler type"); + break; + } + } + catch (NotSupportedException) + { + // Some platforms might throw NotSupportedException + // when accessing handler options } } } From da68021837ff32b88104c9358f7d7e66b89d3456 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 8 Jul 2021 09:12:39 -0700 Subject: [PATCH 2/2] cl --- sdk/core/Azure.Core/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/core/Azure.Core/CHANGELOG.md b/sdk/core/Azure.Core/CHANGELOG.md index cead36ec0579..6b6944a6716a 100644 --- a/sdk/core/Azure.Core/CHANGELOG.md +++ b/sdk/core/Azure.Core/CHANGELOG.md @@ -10,6 +10,7 @@ ### Fixed +- Fixed `NotSupportedException` when running in Unity. ## 1.16.0 (2021-06-30)