File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
src/ModelContextProtocol.Core
tests/ModelContextProtocol.Tests/Server Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -771,8 +771,11 @@ private static TimeSpan GetElapsed(long startingTimestamp) =>
771771
772772 /// <summary>
773773 /// Converts the Exception.Data dictionary to a serializable Dictionary<string, object?>.
774- /// Returns null if the data dictionary is empty.
774+ /// Returns null if the data dictionary is empty or contains no string keys .
775775 /// </summary>
776+ /// <remarks>
777+ /// Only entries with string keys are included in the result. Entries with non-string keys are ignored.
778+ /// </remarks>
776779 private static Dictionary < string , object ? > ? ConvertExceptionData ( System . Collections . IDictionary data )
777780 {
778781 if ( data . Count == 0 )
Original file line number Diff line number Diff line change @@ -721,11 +721,9 @@ await transport.SendMessageAsync(
721721 Assert . NotNull ( error . Error . Data ) ;
722722
723723 // Verify the data contains the uri
724- var dataJson = JsonSerializer . Serialize ( error . Error . Data , McpJsonUtilities . DefaultOptions ) ;
725- var dataObject = JsonSerializer . Deserialize < JsonObject > ( dataJson , McpJsonUtilities . DefaultOptions ) ;
726- Assert . NotNull ( dataObject ) ;
727- Assert . True ( dataObject . ContainsKey ( "uri" ) ) ;
728- Assert . Equal ( resourceUri , dataObject [ "uri" ] ? . GetValue < string > ( ) ) ;
724+ var dataDict = Assert . IsType < Dictionary < string , object ? > > ( error . Error . Data ) ;
725+ Assert . True ( dataDict . ContainsKey ( "uri" ) ) ;
726+ Assert . Equal ( resourceUri , dataDict [ "uri" ] ) ;
729727
730728 await transport . DisposeAsync ( ) ;
731729 await runTask ;
You can’t perform that action at this time.
0 commit comments