Closed kevin-mcmanus closed 9 months ago
Thanks for the detailed reproduction! This turned out to be an issue with the schema builder; a "string"
schema was generated for Uri?
instead of ["null", "string"]
. The fix will ship with the next release.
I'm trying to serialize/deserialize a class containing a nullable Uri property (
Uri?
). Everything works as expected when the Uri is populated, but when it isnull
I get aNullReferenceException
.Looking at StringSerializerBuilderCase, Uri is the only special case that's a reference type, where as the others (
DateTime
,Guid
, etc.) are allstructs
and behave well.What is the best way to serialize a null Uri correctly?
This code reproduces the issue:
It throws: