SenseNet / sensenet

Open Source Content Services Platform written in .NET
https://sensenet.com
GNU General Public License v2.0
173 stars 112 forks source link

Some queries throw ArgumentNullException #1953

Closed HegyiOliver closed 7 months ago

HegyiOliver commented 1 year ago

We have a web application with a searchbar that uses Sensenet.Client 2.0.4 to query the searched content. Most of the time it works fine but sometimes the response doesn't contain any result, even though it should. The reason for it is that Newtonsoft.Json throws an ArgumentNullException when trying to deserialize the received json.

System.ArgumentNullException HResult=0x80004003 Message=Value cannot be null. Source=Newtonsoft.Json StackTrace: at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName) in //Src/Newtonsoft.Json/Utilities/ValidationUtils.cs:line 40 at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) in //Src/Newtonsoft.Json/JsonConvert.cs:line 827 at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, JsonSerializerSettings settings) in /_/Src/Newtonsoft.Json/JsonConvert.cs:line 696 at SenseNet.Client.JsonHelper.Deserialize(String json) in JsonHelper.cs:line 38 at SenseNet.Client.RESTCaller.d__8.MoveNext() in RESTCaller.cs:line 146

This exception was originally thrown at this call stack: Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(object, string) in ValidationUtils.cs Newtonsoft.Json.JsonConvert.DeserializeObject(string, System.Type, Newtonsoft.Json.JsonSerializerSettings) in JsonConvert.cs Newtonsoft.Json.JsonConvert.DeserializeObject(string, Newtonsoft.Json.JsonSerializerSettings) in JsonConvert.cs SenseNet.Client.JsonHelper.Deserialize(string) in JsonHelper.cs SenseNet.Client.RESTCaller.GetCollectionAsync(SenseNet.Client.ODataRequest, SenseNet.Client.ServerContext) in RESTCaller.cs