使用以下查询,当结果为空时,我得到一个Neo4jclient内部ArgumentException:
graphClient.Cypher
.Match("(a:Application {Id: {pId}})")
.WithParams(new { pId = request.Id })
.With("a")
.OptionalMatch("(a)-[:Uses]->(db:Database)")
.ReturnDistinct(db => db.As<DatabaseDto>());
结果是:
Additional information: Neo4j returned a valid response, however Neo4jClient was unable to deserialize into the object structure you supplied.
Include this raw JSON, with any sensitive values replaced with non-sensitive equivalents:
{
"columns" : [ "db" ],
"data" : [ [ null ] ]
}
Parameter name: content
Source=Neo4jClient
ParamName=content
StackTrace:
at Neo4jClient.Serialization.CypherJsonDeserializer`1.Deserialize(String content) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Serialization\CypherJsonDeserializer.cs:line 61
at Neo4jClient.GraphClient.<>c__DisplayClass1e`1.<Neo4jClient.IRawGraphClient.ExecuteGetCypherResultsAsync>b__1d(Task`1 responseTask) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 820
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
InnerException: System.InvalidOperationException
HResult=-2146233079
Message=While trying to map some JSON into an object of type ....DatabaseDto, we failed to find an expected property (Id) in the JSON at path data[0][0].
此令牌的JSON块是:
Source=Neo4jClient
StackTrace:
at Neo4jClient.Serialization.CommonDeserializerMethods.Map(DeserializationContext context, Object targetObject, JToken parentJsonToken, IEnumerable`1 typeMappings, Int32 nestingLevel) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Serialization\CommonDeserializerMethods.cs:line 321
at Neo4jClient.Serialization.CommonDeserializerMethods.CreateAndMap(DeserializationContext context, Type type, JToken element, IEnumerable`1 typeMappings, Int32 nestingLevel) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Serialization\CommonDeserializerMethods.cs:line 274
at Neo4jClient.Serialization.CypherJsonDeserializer`1.<>c__DisplayClass1b.<ParseInSingleColumnMode>b__19(JToken row) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Serialization\CypherJsonDeserializer.cs:line 175
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Neo4jClient.Serialization.CypherJsonDeserializer`1.Deserialize(String content) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Serialization\CypherJsonDeserializer.cs:line 34
InnerException: System.InvalidOperationException
HResult=-2146233079
Message=Cannot access child value on Newtonsoft.Json.Linq.JValue.
Source=Newtonsoft.Json
StackTrace:
at Newtonsoft.Json.Linq.JToken.get_Item(Object key)
at Neo4jClient.Serialization.CommonDeserializerMethods.Map(DeserializationContext context, Object targetObject, JToken parentJsonToken, IEnumerable`1 typeMappings, Int32 nestingLevel) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Serialization\CommonDeserializerMethods.cs:line 317
InnerException:
答案 0 :(得分:1)
我无法重新创建您在此处遇到的确切异常,但我重新创建了该方案并发现了一个错误。这已在1.0.0.654中修复。
https://github.com/Readify/Neo4jClient/commit/25b8d3701a0745fbb577e81005da8254c0d67f6f
尝试升级。如果有效,请将此答案标记为已接受。如果没有,请执行异常所说的内容并在https://github.com/Readify/Neo4jClient/issues?state=open而不是在StackOverflow上提出问题。