-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
dotnet/corefx
#40991Description
Repro:
IDictionary<string, float?> dict = new Dictionary<string, float?>
{
{"Y2016", 42.0f}
};
JsonSerializer.Serialize(new
{
Foo = dict
});
Throws:
NotSupportedException: Specified method is not supported.
System.Text.Json.JsonSerializer.WriteDictionary<TProperty>(JsonConverter<TProperty> converter, JsonSerializerOptions options, ref WriteStackFrame current, Utf8JsonWriter writer)
System.Text.Json.JsonPropertyInfoNotNullable<TClass, TDeclaredProperty, TRuntimeProperty, TConverter>.OnWriteDictionary(ref WriteStackFrame current, Utf8JsonWriter writer)
System.Text.Json.JsonPropertyInfo.WriteDictionary(ref WriteStack state, Utf8JsonWriter writer)
System.Text.Json.JsonSerializer.HandleDictionary(JsonClassInfo elementClassInfo, JsonSerializerOptions options, Utf8JsonWriter writer, ref WriteStack state)
System.Text.Json.JsonSerializer.HandleObject(JsonPropertyInfo jsonPropertyInfo, JsonSerializerOptions options, Utf8JsonWriter writer, ref WriteStack state)
System.Text.Json.JsonSerializer.WriteObject(JsonSerializerOptions options, Utf8JsonWriter writer, ref WriteStack state)
System.Text.Json.JsonSerializer.Write(Utf8JsonWriter writer, int originalWriterDepth, int flushThreshold, JsonSerializerOptions options, ref WriteStack state)
System.Text.Json.JsonSerializer.WriteCore(Utf8JsonWriter writer, PooledByteBufferWriter output, object value, Type type, JsonSerializerOptions options)
System.Text.Json.JsonSerializer.WriteCore(PooledByteBufferWriter output, object value, Type type, JsonSerializerOptions options)
System.Text.Json.JsonSerializer.WriteCoreString(object value, Type type, JsonSerializerOptions options)
System.Text.Json.JsonSerializer.Serialize<TValue>(TValue value, JsonSerializerOptions options)
Using Dictionary instead of IDictionary fixes it.
Reactions are currently unavailable