libphonenumber-csharp icon indicating copy to clipboard operation
libphonenumber-csharp copied to clipboard

cannot directly serialize PhoneNumber

Open AartBluestoke opened this issue 5 years ago • 0 comments

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

AartBluestoke avatar Nov 18 '20 04:11 AartBluestoke