- 
                Notifications
    You must be signed in to change notification settings 
- Fork 555
Closed as not planned
Closed as not planned
Copy link
Labels
testIssue related to testsIssue related to tests
Description
There is a race between the StdioServerTransport.StartListeningAsync()  and StdioServerTransport.SendMessageAsync calls since the former spins up a task that switches off the IsConnected flag before SendMessageAsync can finish sending a message. I can only reproduce this in CI.
[xUnit.net 00:00:07.02]     ModelContextProtocol.Tests.Transport.StdioServerTransportTests.SendMessageAsync_Should_Send_Message [FAIL]
  Failed ModelContextProtocol.Tests.Transport.StdioServerTransportTests.SendMessageAsync_Should_Send_Message [11 ms]
  Error Message:
   ModelContextProtocol.Protocol.Transport.McpTransportException : Transport is not connected
  Stack Trace:
     at ModelContextProtocol.Protocol.Transport.StdioServerTransport.SendMessageAsync(IJsonRpcMessage message, CancellationToken cancellationToken) in /home/runner/work/csharp-sdk/csharp-sdk/src/ModelContextProtocol/Protocol/Transport/StdioServerTransport.cs:line 109
   at ModelContextProtocol.Tests.Transport.StdioServerTransportTests.SendMessageAsync_Should_Send_Message() in /home/runner/work/csharp-sdk/csharp-sdk/tests/ModelContextProtocol.Tests/Transport/StdioServerTransportTests.cs:line 75
   at ModelContextProtocol.Tests.Transport.StdioServerTransportTests.SendMessageAsync_Should_Send_Message() in /home/runner/work/csharp-sdk/csharp-sdk/tests/ModelContextProtocol.Tests/Transport/StdioServerTransportTests.cs:line 80
Metadata
Metadata
Assignees
Labels
testIssue related to testsIssue related to tests