Fix process crash when testing Stderr (#1449)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Eric StJohn 2026-04-06 11:29:00 -07:00 • committed by GitHub
commit 2e7209c35a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -181,9 +181,10 @@ public class McpServerOptionsSetupTests
};
})
.WithResources<SimpleResourceType>()
.WithStdioServerTransport();
.WithStreamServerTransport(Stream.Null, Stream.Null);
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
await using var sp = services.BuildServiceProvider();
var options = sp.GetRequiredService<IOptions<McpServerOptions>>().Value;
// The options should preserve the user's manually set capabilities
Assert.NotNull(options.Capabilities?.Resources);