Because of the publicly visible member "defaultInstanceForType" which is self-referential.
If you are using newtonsoft for searialization this requires serializing everything with "Newtonsoft.Json.ReferenceLoopHandling.Ignore," (which could be dangerous, the default is to throw an exception by default for a good reason),
if you use the new c# language serializer, it will just crash with recursion limit exceeded.
Could the defaultInstanceForType please be annotated with 'don't serialize this', as it isn't part of the object state.
Because of the publicly visible member "defaultInstanceForType" which is self-referential. If you are using newtonsoft for searialization this requires serializing everything with "Newtonsoft.Json.ReferenceLoopHandling.Ignore," (which could be dangerous, the default is to throw an exception by default for a good reason),
if you use the new c# language serializer, it will just crash with recursion limit exceeded.
Could the defaultInstanceForType please be annotated with 'don't serialize this', as it isn't part of the object state.
https://dotnetfiddle.net/rJNvxd