Struct visitors are useful (no allocations), but they're tricky, as side-effects may not be preserved when they are copied by the underlying deserializer.
Most importantly, a Native AOT bug
(https://github.com/dotnet/runtime/issues/77070) currently causes some static abstract interface calls to fail when they have to be loaded at runtime. Generic specialization can avoid this. By using a struct visitor for some compound calls (dictionaries, enumerables, nullables) the likelihood of hitting this is reduced.
Struct visitors are useful (no allocations), but they're tricky, as side-effects may not be preserved when they are copied by the underlying deserializer.
Most importantly, a Native AOT bug (https://github.com/dotnet/runtime/issues/77070) currently causes some static abstract interface calls to fail when they have to be loaded at runtime. Generic specialization can avoid this. By using a struct visitor for some compound calls (dictionaries, enumerables, nullables) the likelihood of hitting this is reduced.