CustomAdapter.Read(Async) throws StackOverflowException when no match on Search.

My CustomAdapter implementation throws StackOverflowException when no match is found on Search. If there  are matches, no exception occur.

I put the breakpoint on the beginning of the ReadAsync function and found the method calls once when there are matches; otherwise, it keeps called and causes StackOverflowException.

Image_1986_1712436202913 
Image_8124_1712436306447

public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string additionalParam = null)
{
    var dataSource = _dbContext.Assets.AsQueryable<Asset>();
    //IEnumerable<Asset> dataSource = await _dbContext.Assets.ToListAsync();

    // Searching
    if (dataManagerRequest.Search != null && dataManagerRequest.Search.Count > 0)
        dataSource = DataOperations.PerformSearching(dataSource, dataManagerRequest.Search);

    // Sorting
    if (dataManagerRequest.Sorted != null && dataManagerRequest.Sorted.Count > 0)
        dataSource = DataOperations.PerformSorting(dataSource, dataManagerRequest.Sorted);

    // Filtering
    if (dataManagerRequest.Where != null && dataManagerRequest.Where.Count > 0)
        dataSource = DataOperations.PerformFiltering(dataSource, dataManagerRequest.Where, dataManagerRequest.Where[0].Operator);

    //Paging
    if (dataManagerRequest.Skip != 0)
        dataSource = DataOperations.PerformSkip(dataSource, dataManagerRequest.Skip);
    if (dataManagerRequest.Take != 0)
        dataSource = DataOperations.PerformTake(dataSource, dataManagerRequest.Take);

    var count = _dbContext.Assets.Count();
    return dataManagerRequest.RequiresCounts
        ? new DataResult() { Result = dataSource, Count = count }
        : dataSource;
}

<SfGrid TValue="Asset" AllowSorting="true" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Delete", "Search" })">
    <SfDataManager AdaptorInstance="@typeof(EquipmentLogbook.Data.AssetDataAdapter)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
    <GridPageSettings PageSize="5"></GridPageSettings>
    <GridEditSettings AllowDeleting="true" AllowAdding="true" Mode="@EditMode.Dialog"></GridEditSettings>
    <GridSelectionSettings EnableToggle="true" Mode="Syncfusion.Blazor.Grids.SelectionMode.Row"></GridSelectionSettings>
    <GridEvents RowSelected="OnAssetSelected" TValue="Asset" />
    <GridColumns>
        <GridColumn Field=@nameof(Asset.Id) IsPrimaryKey="true" />
    </GridColumns>
</SfGrid>

1 Reply

PS Prathap Senthil Syncfusion Team April 9, 2024 03:20 PM UTC

Hi Yongkee,


we are unable to reproduce the reported problem when attempting to replicate it in the latest version 25.1.39. For your reference, we have attached a screenshot.  we require some additional clarification from your end. Please share the following details to proceed further on our end:

A screenshot of a computer

Description automatically generated


  • To analyze the reported issue, could you please share a simple and reproducible sample with duplicate data that demonstrates the problem? This will assist us in identifying the issue more efficiently and providing a resolution.
  • If possible, kindly share your attempt to replicate the issue using the previous attached sample.

The details requested above will be very helpful in validating the reported query on our end and providing a solution as soon as possible. Thanks for your understanding.

Note: After connecting the database, we need to copy the path of the database and change the connection string with the copied path in appsettings.json file based on the NORTHWND.MDF file


Regards,

Prathap S


Attachment: BlazorDataGridSQLNet8_7981ea3.zip

Loader.
Up arrow icon