Add client completion notification and details (#1368)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Stephen Toub 2026-03-02 09:17:22 -05:00 • committed by GitHub
commit b965a7eca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -90,13 +90,15 @@ public abstract partial class TransportBase : ITransport
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
protected async Task WriteMessageAsync(JsonRpcMessage message, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
if (!IsConnected)
{
throw new InvalidOperationException("Transport is not connected.");
// Transport disconnected concurrently. Silently drop rather than throw,
// to avoid surfacing spurious errors during shutdown races.
return;
}
cancellationToken.ThrowIfCancellationRequested();
if (_logger.IsEnabled(LogLevel.Debug))
{
var messageId = (message as JsonRpcMessageWithId)?.Id.ToString() ?? "(no id)";