Microsoft-authentication-library-for-dotnet: [Bug] MSAL should not set ServicePointManager.DefaultConnectionLimit

Created on 14 Aug 2020  路  2Comments  路  Source: AzureAD/microsoft-authentication-library-for-dotnet

Which Version of MSAL are you using ?
MSAL 4.17.1.0

Platform
.NET Framework 4.6.2

What authentication flow has the issue?
Client credentials

Is this a new or existing app?
This is a new app or experiment

Repro

ServicePointManager.DefaultConnectionLimit = 100;
Console.WriteLine($"My DefaultConnectionLimit {ServicePointManager.DefaultConnectionLimit}"); // prints 100

var aadApplication = ConfidentialClientApplicationBuilder.Create("(redacted)")
    .WithClientSecret("(redacted)")
    .WithAuthority(AzureCloudInstance.AzurePublic, "(redacted)")
    .Build();

var authResponse = await aadApplication
    .AcquireTokenForClient(new[] { "(redacted)" })
    .WithSendX5C(true)
    .ExecuteAsync();

Console.WriteLine($"DefaultConnectionLimit after using MSAL {ServicePointManager.DefaultConnectionLimit}"); // prints 30

Expected behavior
MSAL should not change ServicePointManager.DefaultConnectionLimit.

Actual behavior
MSAL overrides the ServicePointManager.DefaultConnectionLimit set by the application. This is an global setting which should not be changed by a client library.

Possible Solution
Do not set ServicePointManager.DefaultConnectionLimit (or make it in an opt-in feature).

Fixed P2 bug

All 2 comments

I agree @jonpayne , MSAL should not change global settings.

Fix is in 4.18

Was this page helpful?
0 / 5 - 0 ratings