Skip to content

ModelContextProtocol.AspNetCore.Tests.StreamableHttpServerConformanceTests.McpServer_UsedOutOfScope_CanSendNotifications failed in rolling build #1237

@ericstj

Description

@ericstj

See https://github.com/modelcontextprotocol/csharp-sdk/actions/runs/21529461255/job/62041474097

  Failed ModelContextProtocol.AspNetCore.Tests.StreamableHttpServerConformanceTests.McpServer_UsedOutOfScope_CanSendNotifications [13 s]
  Error Message:
   System.Threading.Tasks.TaskCanceledException : The request was canceled due to the configured HttpClient.Timeout of 10 seconds elapsing.
---- System.TimeoutException : The operation was canceled.
-------- System.Threading.Tasks.TaskCanceledException : The operation was canceled.
------------ System.InvalidOperationException : Reading is not allowed after reader was completed.
  Stack Trace:
     at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at ModelContextProtocol.AspNetCore.Tests.StreamableHttpServerConformanceTests.CallInitializeAndValidateAsync() in /_/tests/ModelContextProtocol.AspNetCore.Tests/StreamableHttpServerConformanceTests.cs:line 712
   at ModelContextProtocol.AspNetCore.Tests.StreamableHttpServerConformanceTests.McpServer_UsedOutOfScope_CanSendNotifications() in /_/tests/ModelContextProtocol.AspNetCore.Tests/StreamableHttpServerConformanceTests.cs:line 595
--- End of stack trace from previous location ---
----- Inner Stack Trace -----

----- Inner Stack Trace -----
   at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.CopyToAsyncCore(Stream destination, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionResponseContent.<SerializeToStreamAsync>g__Impl|6_0(Stream stream, CancellationToken cancellationToken)
   at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
----- Inner Stack Trace -----
   at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed()
   at System.IO.Pipelines.Pipe.AdvanceReader(SequencePosition& consumed, SequencePosition& examined)
   at System.IO.Pipelines.Pipe.AdvanceReader(SequencePosition& consumed)
   at System.IO.Pipelines.Pipe.DefaultPipeReader.AdvanceTo(SequencePosition consumed)
   at System.IO.Pipelines.PipeReaderStream.HandleReadResult(ReadResult result, Span`1 buffer)
   at System.IO.Pipelines.PipeReaderStream.HandleReadResult(ReadResult result, Span`1 buffer)
   at System.IO.Pipelines.PipeReaderStream.ReadAsyncInternal(Memory`1 buffer, CancellationToken cancellationToken)
   at ModelContextProtocol.AspNetCore.Tests.Utils.KestrelInMemoryConnection.DuplexStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken) in /_/tests/ModelContextProtocol.AspNetCore.Tests/Utils/KestrelInMemoryConnection.cs:line 82
   at System.Net.Http.HttpConnection.FillAsync(Boolean async)
   at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.CopyToAsyncCore(Stream destination, CancellationToken cancellationToken)
  Standard Output Messages:
 | [2026-01-30T20:26:01] Microsoft.Extensions.Hosting.Internal.Host Debug: Hosting starting
 | [2026-01-30T20:26:02] Microsoft.AspNetCore.Server.Kestrel Debug: No listening endpoints were configured. Binding to http://localhost:5000 by default.
 | [2026-01-30T20:26:02] Microsoft.Hosting.Lifetime Information: Now listening on: http://localhost:5000
 | [2026-01-30T20:26:02] Microsoft.AspNetCore.Hosting.Diagnostics Debug: Loaded hosting startup assembly ModelContextProtocol.AspNetCore.Tests
 | [2026-01-30T20:26:02] Microsoft.Hosting.Lifetime Information: Application started. Press Ctrl+C to shut down.
 | [2026-01-30T20:26:02] Microsoft.Hosting.Lifetime Information: Hosting environment: Production
 | [2026-01-30T20:26:02] Microsoft.Hosting.Lifetime Information: Content root path: D:\a\csharp-sdk\csharp-sdk\artifacts\bin\ModelContextProtocol.AspNetCore.Tests\Debug\net9.0
 | [2026-01-30T20:26:02] Microsoft.Extensions.Hosting.Internal.Host Debug: Hosting started
 | [2026-01-30T20:26:02] Microsoft.AspNetCore.Server.Kestrel.Connections Debug: Connection id "37d67aa38e8247dc9187e7b404df211a" accepted.
 | [2026-01-30T20:26:02] Microsoft.AspNetCore.Server.Kestrel.Connections Debug: Connection id "37d67aa38e8247dc9187e7b404df211a" started.
 | [2026-01-30T20:26:03] Microsoft.AspNetCore.Hosting.Diagnostics Information: Request starting HTTP/1.1 POST http://localhost:5000/ - application/json;+charset=utf-8 170
 | [2026-01-30T20:26:03] Microsoft.AspNetCore.Routing.Matching.DfaMatcher Debug: 1 candidate(s) found for the request path '/'
 | [2026-01-30T20:26:03] Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware Debug: Request matched endpoint 'MCP Streamable HTTP | HTTP: POST /'
 | [2026-01-30T20:26:03] Microsoft.AspNetCore.Routing.EndpointMiddleware Information: Executing endpoint 'MCP Streamable HTTP | HTTP: POST /'
 | [2026-01-30T20:26:05] Microsoft.AspNetCore.Server.Kestrel Debug: Connection id "37d67aa38e8247dc9187e7b404df211a", Request id "37d67aa38e8247dc9187e7b404df211a:00000001": started reading request body.
 | [2026-01-30T20:26:05] Microsoft.AspNetCore.Server.Kestrel Debug: Connection id "37d67aa38e8247dc9187e7b404df211a", Request id "37d67aa38e8247dc9187e7b404df211a:00000001": done reading request body.
 | [2026-01-30T20:26:05] ModelContextProtocol.Server.McpServer Debug: Server (StreamableHttpServerConformanceTests 73) read JsonRpcRequest message from channel.
 | [2026-01-30T20:26:05] ModelContextProtocol.Server.McpServer Information: Server (StreamableHttpServerConformanceTests 73) method 'initialize' request handler called.
 | [2026-01-30T20:26:05] ModelContextProtocol.Server.McpServer Debug: Server (StreamableHttpServerConformanceTests 73), Client (IntegrationTestClient 1.0.0) sending message.
 | [2026-01-30T20:26:12] ModelContextProtocol.Server.McpServer Information: Server (StreamableHttpServerConformanceTests 73), Client (IntegrationTestClient 1.0.0) method 'initialize' request handler completed in 31.3835ms.
 | [2026-01-30T20:26:12] Microsoft.AspNetCore.Routing.EndpointMiddleware Information: Executed endpoint 'MCP Streamable HTTP | HTTP: POST /'
 | [2026-01-30T20:26:12] Microsoft.AspNetCore.Server.Kestrel.Connections Debug: Connection id "37d67aa38e8247dc9187e7b404df211a" completed keep alive response.
 | [2026-01-30T20:26:12] Microsoft.AspNetCore.Hosting.Diagnostics Information: Request finished HTTP/1.1 POST http://localhost:5000/ - 200 - text/event-stream 9596.0900ms
 | [2026-01-30T20:26:12] Microsoft.AspNetCore.Server.Kestrel.Connections Debug: Connection id "37d67aa38e8247dc9187e7b404df211a" disconnecting.
 | [2026-01-30T20:26:12] Microsoft.AspNetCore.Server.Kestrel.Connections Debug: Connection id "37d67aa38e8247dc9187e7b404df211a" stopped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions