Skip to content

Exception even when not using [UseSelection] on field that returns a record type #8486

Closed

Description

@aradalvand

Product

Hot Chocolate

Version

15.1.8

Link to minimal reproduction

services.AddGraphQLServer()
        .AddTypes()
        .AddPagingArguments()
        .AddSorting()
        .AddQueryContext()
        .AddFiltering();

// omitted for brevity

[QueryType]
public static class Query
{
	[UsePaging]
	[UseFiltering]
	[UseSorting]
	public static async Task<Connection<User>> GetUsers(
		PagingArguments paging,
		QueryContext<User> query
	)
	{
		return Connection.Empty<User>();
	}
}

public record User(
	UserId Id,
	FirstName FirstName,
	LastName LastName,
	PhoneNumber PhoneNumber
);

Steps to reproduce

  • Add a query field that returns a record type.
  • Use [UseFiltering] on that field.
  • Enable QueryContext<T> and filtering using .AddQueryContext() and AddFiltering()
  • Run a query selecting your field.

What is expected?

No exception. A QueryContext<T> with a null Selector since we didn't use [UseSelection] on the field.

What is actually happening?

The same exception reported in #6487, even though the OP there is using [UseSelection] and I'm not. When you don't use [UseSelection], the expression-building code that causes this exception shouldn't even be executed; that's the expectation. This what distinguishes this issue from #6487.

Relevant log output

Additional context

No response

Activity

  1. added theissue type on Aug 2, 2025
  2. added
    Area: Data
    on Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Data🌶️ hot chocolate

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions