-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Description
Hi.
I tried the JSON Source Generator as asked too. I was surprised to find that my assembly grew from 7 KiB to 125 KiB after adding source generators even though I only generated code for Person and List<Person>.
public partial record Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
[JsonSerializable(typeof(Person) , GenerationMode = default)]
[JsonSerializable(typeof(List<Person>), GenerationMode = default)]
partial class MyJsonContext : JsonSerializerContext
{
}When looking at the generated code I found a bunch of generated methods that I didn't use and that should be possible to have in a shared library such AssemblySerialize.
It's not really a bug but I felt 120 KiB was a bit too much, especially in a world where we try to squeeze down the size for Blazor WASM Clients.
I wrote a bit about my experience with using JSON source generator here: https://github.com/mrange/T4JsonSerializer
Regards,
Mårten