Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index' #349

Closed
mm-ryo opened this issue Apr 23, 2019 · 7 comments · Fixed by #350
Assignees
Labels

Comments

@mm-ryo
Copy link

mm-ryo commented Apr 23, 2019

Test steps:

  1. when the grid is loaded (default page size is 10)

  2. i navigate to the last page

  3. then change the page size to 50 or any number which is greater than 10.

  4. then the ArgumentOutOfRangeException comes out.

    dll version:
    DevExtreme.AspNet.Data 2.2.0

    npm packages:
    "devextreme": "^18.2.7",
    "devextreme-angular": "^18.2.7",
    "devextreme-aspnet-data-nojquery": "^2.2.0",

DataSourceLoadOptions
    DefaultSort: null
    Filter: null
    Group: null
    GroupSummary: null
    IsCountQuery: false
    PaginateViaPrimaryKey: true
    PreSelect: null
    PrimaryKey: {string[1]}
    RemoteGrouping: null
    RemoteSelect: null
    RequireGroupCount: false
    RequireTotalCount: true
    Select: null
    Skip: 200
    Sort: null
    StringToLower: null
    Take: 50
    TotalSummary: null
  System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.Generic.List`1.System.Collections.IList.get_Item(Int32 index)
   at DevExtreme.AspNet.Data.FilterExpressionCompiler`1.CompileCore(ParameterExpression dataItemExpr, IList criteriaJson)
   at DevExtreme.AspNet.Data.FilterExpressionCompiler`1.Compile(IList criteriaJson)
   at DevExtreme.AspNet.Data.DataSourceExpressionBuilder`1.BuildCore(Expression expr, Boolean paginate, Boolean isCountQuery, Boolean remoteGrouping, IList filterOverride, IReadOnlyList`1 selectOverride)
   at DevExtreme.AspNet.Data.DataSourceLoaderImpl`1.Load()

<dx-data-grid id="grid" [dataSource]="dataSource" [wordWrapEnabled]="true" [allowColumnReordering]="true"
    height="600" showBorders="true">
    <dxo-paging [pageSize]="10"></dxo-paging>
    <dxo-pager [showPageSizeSelector]="true" [allowedPageSizes]="[10,20,50]"></dxo-pager>
    <dxo-selection mode="multiple"></dxo-selection>
    <dxo-filter-row [visible]="true"></dxo-filter-row>
    <dxo-header-filter [visible]="true"></dxo-header-filter>
    <dxo-group-panel [visible]="true"></dxo-group-panel> 
    <dxo-grouping [autoExpandAll]="false"></dxo-grouping>
    <dxo-remote-operations [sorting]="true" [paging]="true" [filtering]='true' [grouping]='true' [groupPaging]='true'>
    </dxo-remote-operations>
    <dxi-column dataField="id" width="280">
    </dxi-column>
    <dxi-column dataField="parentId" width="280" [allowSearch]="true">
    </dxi-column>
    <dxi-column dataField="displayName" [allowSearch]="true">
    </dxi-column>
    <dxi-column dataField="position" width="75" [allowSearch]="true">
    </dxi-column>
    <dxi-column dataField="type" width="100" [allowSearch]="true">
    </dxi-column>
    <dxi-column dataField="iconId" width="100" [allowSearch]="true">
    </dxi-column>
  </dx-data-grid>
@Bykiev
Copy link

Bykiev commented Apr 23, 2019

Same here when PaginateViaPrimaryKey is specified, it's happen when number of pages after filtering/grouping/changing datasource is less than selected page.

@mm-ryo
Copy link
Author

mm-ryo commented Apr 23, 2019

Same here when PaginateViaPrimaryKey is specified, it's happen when number of pages after filtering/grouping/changing datasource is less than selected page.

I have tried the online demo, they don't have this issue. it's so stranger. but i found that the grid made 2 times calling. the first one, it only returns the total count with empty data. second one returns with data.

@Bykiev
Copy link

Bykiev commented Apr 23, 2019

@robinNode, can you please provide the link for the demo?

@AlekseyMartynov
Copy link
Contributor

Thanks for reporting.
I'm working on a fix.

@AlekseyMartynov
Copy link
Contributor

AlekseyMartynov commented Apr 24, 2019

We plan to release version 2.2.1 shortly.
Temporary blocked on this AppVeyor issue.

Additionally, my colleague will post a follow up regarding the double request issue mentioned in #349 (comment).

@Bykiev
Copy link

Bykiev commented Apr 25, 2019

@AlekseyMartynov, AppVeyor issue is resolved, any news when the update will be available on NuGet?

@AlekseyMartynov
Copy link
Contributor

Published: https://www.nuget.org/packages/DevExtreme.AspNet.Data/2.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants