Fix StdioServerTransport.DisposeAsync() hang: CancellableStdinStream missing Dispose override (#1276)

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-17 16:00:12 -08:00 • committed by GitHub
commit 841e810167
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -59,6 +59,16 @@ public sealed class StdioServerTransport : StreamServerTransport
}
#endif
protected override void Dispose(bool disposing)
{
if (disposing)
{
stdinStream.Dispose();
}
base.Dispose(disposing);
}
// The McpServer shouldn't call flush on the stdin Stream, but it doesn't need to throw just in case.
public override void Flush() { }

View file

@ -24,7 +24,7 @@ public class StdioServerTransportTests : LoggedTest
};
}
[Fact(Skip="https://github.com/modelcontextprotocol/csharp-sdk/issues/143")]
[Fact]
public async Task Constructor_Should_Initialize_With_Valid_Parameters()
{
// Act