Skip to content

Broken "Include" after "Skip" #36501

@Hizeqwane

Description

@Hizeqwane

Bug description

Hello.
I found a problem with "Skip" when querying an entity with a negative ID - the "Include" mechanism breaks.
Initially, the query was more complex, but I managed to simplify it to the state shown in the screenshots.

Reproduced on packages:
Microsoft.EntityFrameworkCore.Design Version 8.0.11
Microsoft.EntityFrameworkCore.Tools Version 8.0.11
Npgsql Version 8.0.6
Npgsql.EntityFrameworkCore.PostgreSQL Version 8.0.11

Unfortunately, there is no way to check on later versions.

P.S. I'm sorry, but I don't have the ability to write a console application that reproduces the issue.

Image
Image

Your code

var normalObj = await context
            .Set<MyObject>()
            .AsNoTracking()
            .Include(s => s.Kinds)
            .FirstAsync(s => s.Id == -8001);
        
        var brokenIncludeList = await context
            .Set<MyObject>()
            .AsNoTracking()
            .Include(s => s.Kinds)
            .Skip(1)
            .ToListAsync();

        var brokenInclude = brokenIncludeList.First(s => s.Id == -8001);

Stack traces

The error is related to the system's behavior rather than the thrown exception

Verbose output


EF Core version

8.0.11

Database provider

Npgsql

Target framework

.NET 8.0

Operating system

Windows 10

IDE

JetBrains Rider 2023.3.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions