Basically, what I want is when there is deserialization error simply to log the error, skip this object and proceed. I've set
return JsonConvert.DeserializeObject<IList<T>>(json, new JsonSerializerSettings
{
Error = (sender, args) => { args.ErrorContext.Handled = true; },
NullValueHandling = NullValueHandling.Ignore
});
I get the error and can be logged, but it still creates object with default value for the property where it failed to deserialize. I just want objects with deserialization error to not be part of the list I'm returning. Is there a way?