You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Source generator doesn't support [JsonExtensionData] #58273
The [JsonExtensionData] attribute is not supported and silently fails.
Expect that the parser detects that attribute and passes that information\metadata to the serializer (best long-term), or we generate a design-time error (to help scope V6).
Repro:
usingSystem.Text.Json;usingSystem.Text.Json.Serialization;usingTest;POCO?poco=JsonSerializer.Deserialize("{\"Hello\":42}",MyContext.Default.POCO);// Non-source gen works:// POCO? poco = JsonSerializer.Deserialize<POCO>("{\"Hello\":42}");// Throws since Overflow is nullConsole.WriteLine(poco.Overflow["Hello"]);namespaceTest{[JsonSerializable(typeof(POCO))]publicpartialclassMyContext:JsonSerializerContext{}publicpartialclassPOCO{[JsonExtensionData]publicDictionary<string,JsonElement>Overflow{get;set;}}}
Activity