-
Notifications
You must be signed in to change notification settings - Fork 494
Closed
Description
This is because the read loop in the core transport abstraction uses TextWriter
:
csharp-sdk/src/ModelContextProtocol/Protocol/Transport/StreamClientSessionTransport.cs
Line 99 in 08f9cdb
if (await _serverOutput.ReadLineAsync(cancellationToken).ConfigureAwait(false) is not string line) |
var line = await _inputReader.ReadLineAsync(shutdownToken).ConfigureAwait(false); |
Which in netstandard2.0
is not cancellable and requires a polyfill that does not properly honor the cancellation token:
csharp-sdk/src/Common/Polyfills/System/IO/TextReaderExtensions.cs
Lines 5 to 13 in 08f9cdb
public static Task<string> ReadLineAsync(this TextReader reader, CancellationToken cancellationToken) | |
{ | |
if (cancellationToken.IsCancellationRequested) | |
{ | |
return Task.FromCanceled<string>(cancellationToken); | |
} | |
return reader.ReadLineAsync(); | |
} |
Metadata
Metadata
Assignees
Labels
No labels