Skip to content

Paginate: Exception Thrown with 0 Index for PageIndex #20

@DavidRogersDev

Description

@DavidRogersDev

I think there may be a problem with the Paginated-related code.

I incorporated your repository (EntityRepository) into a project of mine. Whilst running a few scenarios, I found that if I made a call to the overload of Paginate, which takes PageIndex and PageSize as parameters, and passed in a PageIndex of 0 (e.g. Paginate(0, 2)) then an exception would be thrown in the extension method ToPaginatedList.

That would mean you would be passing -2 into the
Skip method. The actual text of the ArgumentException is

Count must have a non-negative value. Parameter name: count

Then I thought you possibly wanted to use an index of 1 for the first page instead of 0. But that does not seem to be the case as I got erroneous results testing that theory.

Let me know if you cannot reproduce the error.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions