Flurl icon indicating copy to clipboard operation
Flurl copied to clipboard

Support new System.Text.Json source generator

Open tranb3r opened this issue 7 months ago • 3 comments

Hi,

Is there any plan to support the new System.Text.Json source generator, in a future version of Flurl? https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/

I think it would require new extensions, similar to PostJsonAsync or ReceiveJson, but with an additionnal parameter (either JsonTypeInfo or JsonSerializerContext). Or maybe it's already supported and I'm missing something?

Thanks

tranb3r avatar Dec 04 '23 07:12 tranb3r

Not familiar with this, I'll read up on it when I have some time. In a nutshell, what are you looking to accomplish?

tmenier avatar Dec 15 '23 02:12 tmenier

Well, basically this new SG eliminates runtime reflection (amongst other improvements). Which is critical for linker and native-aot stuff (aka the future of .NET). The article explains the details of it, we can discuss the changes after you read it, nothing urgent.

tranb3r avatar Dec 15 '23 07:12 tranb3r

+1 to this one.

Implementing overloads of methods like GetJsonAsync and PostJsonAsync which take in JsonTypeInfo or JsonSerializerContext as parameters will really help folks wanting to leverage source generators for improved JSON serialization performance, as well as AoT (like @tranb3r mentions).

wbaldoumas avatar Feb 18 '24 22:02 wbaldoumas