Skip to content

Add Failing Test for Null Type Serialization#1038

Closed
AceCoderLaura wants to merge 2 commits intoaaubry:masterfrom
AceCoderLaura:serialize-null-types
Closed

Add Failing Test for Null Type Serialization#1038
AceCoderLaura wants to merge 2 commits intoaaubry:masterfrom
AceCoderLaura:serialize-null-types

Conversation

@AceCoderLaura
Copy link
Copy Markdown

Added a test to demonstrate a bug where CLR types can't be serialised if they're null.

fdcastel added a commit to fdcastel/YamlDotNet that referenced this pull request Mar 26, 2026
SystemTypeConverter.WriteYaml() now handles null values by emitting an
empty scalar instead of crashing with NullReferenceException.

SystemTypeConverter.ReadYaml() now handles empty/null scalar values by
returning null instead of throwing on Type.GetType().

Added tests: CanSerializeNullType, CanSerializeNonNullType,
NullTypeRoundTrips, NonNullTypeRoundTrips.

Fixes the issue reported in PR aaubry#1038.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant