Open augustoproiete opened 3 years ago
It would be great if you could repro this as a unit test in the https://github.com/RicoSuter/NJsonSchema repo
@RicoSuter I was able to dig more into this over the weekend, and it turns out that this is the same problem described in https://github.com/RicoSuter/NJsonSchema/issues/929
The NRE is being caused by calling ShouldSerialize
without providing an instance (which IMHO is not the correct usage).
I understand from your comment from March 2019 that you prefer to keep this behavior to avoid breaking users relying on ShouldSerialize
containing static logic only.
If you still think that way, can we have a switch that allows us to opt-out of this behavior and assume shouldSerialize = true
without ever calling ShouldSerialize
(and thus never throwing the NullReferenceException
)?
Ok but how do we work around this? I can't imagine JsonPatchDocument<T>
not being a common parameter type for an API ...
I get a
NullReferenceException
if I have any controller receivingJsonPatchDocument<T>
.Minimal reproducible example here:
Call Stack