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:
parent
186cb93630
commit
841e810167
2 changed files with 11 additions and 1 deletions
|
|
@ -59,6 +59,16 @@ public sealed class StdioServerTransport : StreamServerTransport
|
||||||
}
|
}
|
||||||
#endif
|
#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.
|
// The McpServer shouldn't call flush on the stdin Stream, but it doesn't need to throw just in case.
|
||||||
public override void Flush() { }
|
public override void Flush() { }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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()
|
public async Task Constructor_Should_Initialize_With_Valid_Parameters()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue