Wrap each request in a service scope (#276)

* Wrap each request in a service scope

* Change request/notification delegates to return ValueTask

* Address feedback
This commit is contained in:
Stephen Toub 2025-04-11 19:19:12 -04:00 • committed by GitHub
commit f4c87f5e2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,8 +9,6 @@ using System.ComponentModel;
using System.Text.Json.Serialization;
using System.Threading.Channels;
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
namespace ModelContextProtocol.Tests.Configuration;
public partial class McpServerBuilderExtensionsPromptsTests : ClientServerTestBase
@ -144,7 +142,7 @@ public partial class McpServerBuilderExtensionsPromptsTests : ClientServerTestBa
await using (client.RegisterNotificationHandler("notifications/prompts/list_changed", (notification, cancellationToken) =>
{
listChanged.Writer.TryWrite(notification);
return Task.CompletedTask;
return default;
}))
{
serverPrompts.Add(newPrompt);