Skip to content

Commit c350e00

Browse files
Copilotstephentoub
andcommitted
Fix test to use JsonElement.Parse instead of anonymous type serialization
The test was failing on net9.0 due to source-generated JSON serialization not supporting anonymous types. Use JsonElement.Parse with raw JSON string instead. Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
1 parent 5372d24 commit c350e00

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/ModelContextProtocol.Tests/Client/McpClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public async Task CreateSamplingHandler_ShouldUseToolRoleForToolResultMessages()
281281
{
282282
Id = "call_weather_123",
283283
Name = "get_weather",
284-
Input = JsonSerializer.SerializeToElement(new { location = "Paris" }, McpJsonUtilities.DefaultOptions)
284+
Input = JsonElement.Parse("""{"location":"Paris"}""")
285285
}]
286286
},
287287
new SamplingMessage

0 commit comments

Comments
 (0)