Created
March 7, 2026 23:30
-
-
Save AnthonyGiretti/f8c5a433d8415ed6a00d6902340b5e07 to your computer and use it in GitHub Desktop.
.NET 10 adds ReferenceHandler support directly inside JsonSourceGenerationOptionsAttribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Text.Json.Serialization; | |
| // Giving you fine-grained control over how cycles and references are handled at the source generation leve | |
| [JsonSourceGenerationOptions(ReferenceHandler = JsonKnownReferenceHandler.Preserve)] | |
| [JsonSerializable(typeof(Employee))] | |
| internal partial class AppJsonContext : JsonSerializerContext { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment