Remove unnecessary _connectCts field from McpClientImpl (#1323)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
Copilot 2026-02-19 19:42:06 -08:00 • committed by GitHub
commit 49141a300c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,8 +22,6 @@ internal sealed partial class McpClientImpl : McpClient
private readonly SemaphoreSlim _disposeLock = new(1, 1);
private readonly McpTaskCancellationTokenProvider? _taskCancellationTokenProvider;
private CancellationTokenSource? _connectCts;
private ServerCapabilities? _serverCapabilities;
private Implementation? _serverInfo;
private string? _serverInstructions;
@ -526,9 +524,6 @@ internal sealed partial class McpClientImpl : McpClient
/// </summary>
public async Task ConnectAsync(CancellationToken cancellationToken = default)
{
_connectCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
cancellationToken = _connectCts.Token;
try
{
// We don't want the ConnectAsync token to cancel the message processing loop after we've successfully connected.