Skip to content

ToQueryDefinition() throws ArgumentNullException on LINQ query without Where clause #1438

Closed

Description

Describe the bug
Calling .ToQueryDefinition() throws an ArgumentNullException with message Value cannot be null. (Parameter 'sqlQuery') if a Where clause hasn't been added to the LINQ query.

The string representation of the IOrderedQueryable is the url path to the Container.
image

If I set a dummy lambda (.Where(q => true)) the query works.
image

To Reproduce

new CosmosClient("...connection string here...")
    .GetDatabase("AAA")
    .GetContainer("BBB")
    .GetItemLinqQueryable<Test>()
    .ToQueryDefinition();

Expected behavior
The query will return the Items in the Container.

Actual behavior
An ArgumentNullException is thrown.

Environment summary
SDK Version: 3.6.0 and 3.8.0
OS Version: Windows 10, Visual Studio Professional 2019 16.5.3

Additional context
Was previously reported and closed as Resolved: #719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

LINQbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions