.net driver fails with "Method not found: 'System.Threading.Tasks.Task`1<System.Collections.Generic.List`1<Neo4j.Driver.IRecord>>"May 12, 2026Knowledge
Article DetailsDetailsHelp DetailsWhen trying to query the following: var result = await graphClient.Cypher .Match($"(a:FunctionHolder {{Id: '{id.ToString().ToUpper()}'}})-[r:IS_{function.ToString().ToUpper()}_OF*..]->(b)") .With("a,b,r") .Return((a, r, b) => new { FunctionHolder = a.As<Models.FunctionHolder>(), FunctionHolderOf = b.As<Models.FunctionHolder>(), Relationship = r.As<List<Models.Relationship>>() }) .ResultsAsync; you may receive the following exception: Method not found: 'System.Threading.Tasks.Task`1<System.Collections.Generic.List`1<Neo4j.Driver.IRecord>> Neo4j.Driver.ResultCursorExtensions.ToListAsync(Neo4j.Driver.IResultCursor)'. This is due to the Relationship = r.As<List<Models.Relationship>>() part of the Return statement. The r you are returning isn't collected into a List<T> yet - it's still just a node. What you probably want to do instead would be: var result = await graphClient.Cypher .Match($"(a: FunctionHolder {{ Id: '{ id.ToString().ToUpper()}'}})-[r: IS_{ function.ToString().ToUpper()}_OF*..]->(b)") .With("a, b, COLLECT(r) AS r") .Return((a, r, b) => new { FunctionHolder = a.As<Models.FunctionHolder>(), FunctionHolderOf = b.As<Models.FunctionHolder>(), Relationship = r.As<List<Models.Relationship>>() }) .ResultsAsync; In this code we have changed the .With statement to do the COLLECT. An alternative solution could be: var result = await graphClient.Cypher .Match($"(a: FunctionHolder {{ Id: '{ id.ToString().ToUpper()}'}})-[r: IS_{ function.ToString().ToUpper()}_OF*..]->(b)") .Return((a, collect(r), b) => new { FunctionHolder = a.As<Models.FunctionHolder>(), FunctionHolderOf = b.As<Models.FunctionHolder>(), Relationship = r.CollectAs<List<Models.Relationship>>() }) .ResultsAsync;InformationTitle.net driver fails with "Method not found: 'System.Threading.Tasks.Task`1<System.Collections.Generic.List`1<Neo4j.Driver.IRecord>>"Article Created Date3/15/2024, 10:56 PMURL Name25558658048531--net-driver-fails-with-Method-not-found-System-Threading-Tasks-Task-1-System-Collections-Generic-List-1-Neo4j-Driver-IRecordLast Modified Date5/12/2026, 6:52 AM