Does Microsoft Graph .NET SDK CancellationToken Abort In-Flight HTTP Requests or Only the Awaited Task?
0 reputation · 18 Jun 2024, 01:38 UTC
Goal
Determine whether cancelling a CancellationToken passed to a Microsoft Graph .NET SDK method aborts the underlying HTTP request or only the client-side awaited task, and whether completed $batch sub-requests persist after an early client-side cancellation.
Constraints and uncertainty
The SDK accepts a CancellationToken on most service methods, but cancellation after response headers arrive may still return a partial body. $batch sub-requests execute independently, so completed sub-requests are not rolled back when the client stops waiting. Default HttpClient timeout behavior varies by .NET version, and internal SDK retries can obscure the exact cancellation point.
Assume a current Microsoft.Graph SDK version and a modern .NET runtime, but confirm the exact package and runtime because timeout defaults are version-sensitive.
Questions
- Does the SDK cancel the underlying HTTP request when the token is triggered, or only fault the awaited task?
- Do completed
$batchsub-requests persist in Microsoft Graph after the client cancels the wait for remaining responses? - Is the
HttpClienttimeout applied per request attempt or across the full retry sequence?