Skip to content
Introducing AI Conversations: Natural Language Interaction for Your Apps! Learn More

Serialization Release Notes

Feature
New library Shiny.Extensions.Serialization. Centralizes every JsonSerializerContext in your app behind a single shared ISerializer so AOT/source-gen contexts compose via TypeInfoResolverChain instead of fragmenting across services
Feature
Shiny.Json static accessor — self-bootstrapping, sibling to Shiny.Stores. Shiny.Json.Default, AddContext, AddResolver, Configure, Reset, CreateTestScope. Works before DI exists (mobile cold-start path)
Feature
Source generator: [ShinyJsonContext] on a user-declared JsonSerializerContext partial emits a [ModuleInitializer] calling Shiny.Json.AddContext(MyContext.Default) before Main. Drops the services.AddJsonContext(...) boilerplate and fixes “I forgot to register in this code path” bugs
Feature
Source generator: [ShinyJsonInclude] on a type (or [assembly: ShinyJsonInclude(typeof(T))] for foreign types) emits an AOT-safe IJsonTypeInfoResolver providing JsonTypeInfo for List<T>, T[], IEnumerable<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IList<T>, ICollection<T>, and IAsyncEnumerable<T>. Element JsonTypeInfo is resolved lazily from the chain, so collection wrappers compose with any context that supplies the element
Feature
Inline [JsonConverter(typeof(MyConverter))] composes with the generated collection resolver: the converter handles the element (Foo → bare number, custom shape, etc.) and the generated wrapper handles the collection. Fixes the long-standing “single instance works under AOT, List<T> throws” trap
Feature
DI extensions: services.AddJsonSerialization(), AddJsonContext(JsonSerializerContext), ConfigureJsonSerializer(Action<JsonSerializerOptions>), AddSerializer(ISerializer), AddSerializer<TSerializer>(), IServiceProvider.UseSerializer()
Feature
Diagnostic SJSON002 (error) — [ShinyJsonInclude] on an unbound generic. Diagnostic SJSON003 (warning) — [ShinyJsonInclude] on a type with no [JsonSerializable(typeof(T))] declared anywhere in the compilation
Feature
UTF-8 byte and stream overloads on ISerializer: SerializeToUtf8Bytes, Deserialize(ReadOnlySpan<byte>), SerializeAsync(Stream, ...), DeserializeAsync<T>(Stream, ...) and their runtime-typed siblings