querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

NullReferenceException for operations on cloned XQuery

Open p-goodman opened this issue 2 years ago • 0 comments

While the changes in #552 solved the issue with timeouts on update and delete operations, it also relies on the existance of a QueryFactory. Unfortunately the QueryFactory is not set on a cloned instance of a QueryFactory-derived Query, which is why a NullReferenceException is raised.

To reproduce:

var db = new QueryFactory(connection, new SqliteCompiler());

var baseQuery = db.Query().From("Users");
var clonedQuery = baseQuery.Clone();

var totalCount = clonedQuery.AsCount().First<int>();

// System.NullReferenceException in SqlKata.Execution/Query.Extensions.cs, line 369

p-goodman avatar May 06 '22 12:05 p-goodman