Skip to content

Commit 6e244b8

Browse files
committed
fix build issues
1 parent 4d87860 commit 6e244b8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/Microsoft.Graph.Core/Requests/GraphClientFactory.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Microsoft.Graph
99
using System.Net;
1010
using System.Net.Http;
1111
using System.Net.Http.Headers;
12+
using System.Threading;
1213
using Azure.Core;
1314
using Microsoft.Graph.Authentication;
1415
using Microsoft.Kiota.Abstractions.Authentication;
@@ -119,7 +120,7 @@ public static HttpClient Create(
119120
/// <param name="proxy">The proxy to be used with the created client</param>
120121
/// <param name="finalHandler">The last HttpMessageHandler to HTTP calls.</param>
121122
/// <param name="disposeHandler">true if the inner handler should be disposed of by Dispose(), false if you intend to reuse the inner handler..</param>
122-
/// <returns></returns>
123+
/// <returns>An <see cref="HttpClient"/> instance with the configured handlers</returns>
123124
public static HttpClient Create(
124125
BaseBearerTokenAuthenticationProvider authenticationProvider,
125126
IEnumerable<DelegatingHandler> handlers = null,
@@ -133,21 +134,22 @@ public static HttpClient Create(
133134
{
134135
handlers = CreateDefaultHandlers();
135136
}
136-
handlers = handlers.Append(new AuthorizationHandler(authenticationProvider));
137-
return Create(handlers, version, nationalCloud, proxy, finalHandler, disposeHandler);
137+
var handlerList = handlers.ToList();
138+
handlerList.Add(new AuthorizationHandler(authenticationProvider));
139+
return Create(handlerList, version, nationalCloud, proxy, finalHandler, disposeHandler);
138140
}
139141

140142
/// <summary>
141143
/// Creates a new <see cref="HttpClient"/> instance configured to authenticate requests using the provided <see cref="TokenCredential"/>.
142144
/// </summary>
143-
/// <param name="tokenCredential">Token credential object use to initialise an <see cref="AzureIdentityAuthenticationProvider"></param>
145+
/// <param name="tokenCredential">Token credential object use to initialise an <see cref="AzureIdentityAuthenticationProvider"/></param>
144146
/// <param name="handlers">Custom middleware pipeline to which the Authorization handler is appended. If null, default handlers are initialised</param>
145147
/// <param name="version">The Graph version to use in the base URL</param>
146148
/// <param name="nationalCloud">The national cloud endpoint to use</param>
147149
/// <param name="proxy">The proxy to be used with the created client</param>
148150
/// <param name="finalHandler">The last HttpMessageHandler to HTTP calls</param>
149-
/// <param name="disposeHandler">true if the inner handler should be disposed of by Dispose(), false if you intend to reuse the inner handler..</param>
150-
/// <returns></returns>
151+
/// <param name="disposeHandler">true if the inner handler should be disposed of by Dispose(), false if you intend to reuse the inner handler.</param>
152+
/// <returns>An <see cref="HttpClient"/> instance with the configured handlers</returns>
151153
public static HttpClient Create(
152154
TokenCredential tokenCredential,
153155
IEnumerable<DelegatingHandler> handlers = null,
@@ -161,10 +163,11 @@ public static HttpClient Create(
161163
{
162164
handlers = CreateDefaultHandlers();
163165
}
164-
handlers = handlers.Append(new AuthorizationHandler(
166+
var handlerList = handlers.ToList();
167+
handlerList.Add(new AuthorizationHandler(
165168
new AzureIdentityAuthenticationProvider(tokenCredential, null, null, true)
166169
));
167-
return Create(handlers, version, nationalCloud, proxy, finalHandler, disposeHandler);
170+
return Create(handlerList, version, nationalCloud, proxy, finalHandler, disposeHandler);
168171
}
169172

170173
/// <summary>

0 commit comments

Comments
 (0)