Skip to content
Shiny PlatformShiny Platform
.NET MAUI on the WebRun your MAUI app in the browser on WebAssembly - real DOM elements, no Blazor. Try the web sample and the .NET MAUI GalleryGet started

Serialization Release Notes

Fix
Nullable primitives with a value (Guid?, DateTimeOffset?, DateTime?, TimeSpan?, …) threw NotSupportedException: JsonTypeInfo metadata for type 'System.Guid' was not provided once any context or resolver was registered - which is every app, and broke [Bind] store properties of those types. A nullable’s generated converter looks up its underlying type through the serializer’s options, and the built-in primitives were only consulted directly, never added to the options’ resolver chain. They now sit last on that chain, so registered contexts still take precedence
Fix
Primitives and common BCL value types (string, bool, numerics, Guid, DateTime, DateTimeOffset, TimeSpan, Uri, nullable forms, etc.) now serialize without a registered JsonSerializerContext. Previously Shiny.Json.Default.Serialize<string>(...) threw “No JsonTypeInfo registered for type ‘System.String’” unless some registered context happened to include string. Registered contexts still take precedence
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