Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
System.Text.Json now supports serializing and deserializing of IAsyncEnumerable<T> instances.
In previous versions, System.Text.Json serialized IAsyncEnumerable<T> instances as empty JSON objects ({}
). Deserialization failed with a JsonException.
Asynchronous serialization methods now enumerate any IAsyncEnumerable<T> instances in an object graph and then serialize them as JSON arrays. Synchronous serializations methods do not support IAsyncEnumerable<T> serialization and throw a NotSupportedException.
.NET 6
This change can affect source compatibility. If you retarget to .NET 6, you won't get any compile-time errors, but you may encounter run-time serialization behavior differences.
This change was introduced to add support for streaming IAsyncEnumerable<T> responses in ASP.NET Core MVC.
Check if your serialization models contain types that implement IAsyncEnumerable<T> and determine if emitting the enumeration in the JSON output is desirable. You can disable IAsyncEnumerable<T> serialization in one of the following ways:
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowDocumentation
Breaking change: MVC no longer buffers IAsyncEnumerable types when using System.Text.Json - .NET
Learn about the breaking change in ASP.NET Core 6.0 where MVC no longer buffers IAsyncEnumerable return types when formatting using System.Text.Json.
How to customize property names and values with System.Text.Json - .NET
Learn how to customize property names and values when serializing with System.Text.Json in .NET.
Supporting IAsyncEnumerable with LINQ
With IAsyncEnumerable being introduced in .NET Core 3, it's not surprising that developers might want to leverage their existing knowledge of Linq operations when working with async streams.In this episode, Bart De Smet comes on to talk about the System.Linq.Async nuget package that adds some common Linq query operators to IAsyncEnumerable.[01:15] - What's the history behind IAsyncEnumerable?[02:17] - How does the new IAsyncEnumerable compare to the previous?[03:39] - Can IAsyncEnumerable scale to larg