Null Reference Exception while selecting row

Hello

In Blazor webassembly (dot net 6) project while selecting any row in sfGrid I am getting below error.

I am using sfGrid version 19.3.0.57

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]

Unhandled exception rendering component: Object reference not set to an instance of an object.

System.NullReferenceException: Object reference not set to an instance of an object.

at Syncfusion.Blazor.Grids.Internal.Selection`1.d__33[[BlazorApp.Client.Pages.FetchData_SF.Order, BlazorApp.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

at Syncfusion.Blazor.Grids.Internal.Selection`1.d__40[[BlazorApp.Client.Pages.FetchData_SF.Order, BlazorApp.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

at Syncfusion.Blazor.Grids.Internal.Selection`1.d__39[[BlazorApp.Client.Pages.FetchData_SF.Order, BlazorApp.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

at Syncfusion.Blazor.Grids.Internal.Selection`1.d__35[[BlazorApp.Client.Pages.FetchData_SF.Order, BlazorApp.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.d__72[[BlazorApp.Client.Pages.FetchData_SF.Order, BlazorApp.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

at Syncfusion.Blazor.Grids.Internal.GridCell`1.<b__0_5>d[[BlazorApp.Client.Pages.FetchData_SF.Order, BlazorApp.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)



Below is the code I used


@using Syncfusion.Blazor.Grids


<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="false">

<GridPageSettings PageSize="5"></GridPageSettings>

<GridColumns>

<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>

<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>

<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>

</GridColumns>

</SfGrid>


@code{

public List<Order> Orders { get; set; }

SfGrid<Order> Grid { get; set; }

protected override void OnInitialized()

{

Orders = Enumerable.Range(1, 75).Select(x => new Order()

{

OrderID = 1000 + x,

CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],

Freight = 2.1 * x,

OrderDate = DateTime.Now.AddDays(-x),

}).ToList();

}


public class Order {

public int? OrderID { get; set; }

public string CustomerID { get; set; }

public DateTime? OrderDate { get; set; }

public double? Freight { get; set; }

}

}


10 Replies 1 reply marked as answer

TA Tarik Alkathiri December 12, 2021 11:45 AM UTC

I am also facing this issue after I upgraded to Version="19.3.0.57".

Using .Net 6 and Blazor server side.

Please kindly fix this issue ASAP.

Thank you very much for your support.



RS Renjith Singh Rajendran Syncfusion Team December 13, 2021 08:53 AM UTC

Hi Muhammad/Tarik, 
 
Greetings from Syncfusion support. 
 
We have confirmed this as an issue and logged the defect report “NullReference Exception throws when selecting a row in grid for the same. Thank you for taking time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and including the fix in our upcoming bi-weekly release which is expected to be rolled out on or before the mid of December 2021. 
         
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.         
 
Regards, 
Renjith R 



DA Dave December 13, 2021 10:57 PM UTC

I am experiencing the same problem with the same environment as Tarik. Could you please allow me access to the resolution link. Thank you.



RS Renjith Singh Rajendran Syncfusion Team December 14, 2021 10:07 AM UTC

Hi Dave,  
 
Greetings from Syncfusion support. 
 
We have resolved the reported issue in our latest release 19.3.0.59 version. So kindly upgrade to our latest version 19.3.0.59 Syncfusion NuGet package to resolve the reported issue.  
 
Please get back to us if you have any queries. 
 
Regards, 
Renjith R 


Marked as answer

TA Tarik Alkathiri December 14, 2021 01:59 PM UTC

Dear  Renjith

Thank you so much for solving this issue.

Best Regards.



RS Renjith Singh Rajendran Syncfusion Team December 15, 2021 03:58 AM UTC

Hi Tarik, 
 
Thanks for your update. Please get back to us if you need further assistance. 
 
Regards, 
Renjith R 



AN anil January 4, 2022 12:26 PM UTC

Hi Renjith,

after upgrading the framework to the 19.3.0.59 version, still, I am getting this warning on the solution file, not showing on UI.




RS Renjith Singh Rajendran Syncfusion Team January 5, 2022 12:57 PM UTC

Hi anil, 
 
Greetings from Syncfusion support. 
 
We have analyzed the shared error details. We could see that the shared error details are not similar to the one reported and fixed previously in our release. And also we suspect that the exception details seems to be general (related to your application) and not related to Syncfusion(as we could not find Syncfusion related stacktrace from the shared warning details). 
 
So please check this from your side and if you are still facing difficulties then the following details would be helpful for us to proceed further. 
 
  1. Share a simple issue reproducing sample based on your scenario for us to validate.
  2. Share a video demo showing the replication of the problem you are facing.
  3. Share the exact scenario you are reproducing this reported problem.
 
The provided information will help us analyze the problem, and provide you a solution as early as possible. 
 
Regards, 
Renjith R 



IB IBS March 19, 2024 06:44 PM UTC

same error when readasync is triggered


  public override async Task<Object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)

  {

      var data = new List<Student>();

      try

      {

          int Id = 0;

          if (dataManagerRequest.Params != null && dataManagerRequest.Params.Count > 0)

          {


              var val = dataManagerRequest.Params;

              if (val.FirstOrDefault(o => o.Key == "StudentId").Value != null)

              {

                  Id = Convert.ToInt32(val.FirstOrDefault(o => o.Key == "StudentId").Value.ToString());

              }


          }

          data = await Repo.GetAllStudentAsync();

      }

      catch (Exception ex)

      {

          toastService.ShowError(ex.Message.ToString());

      }


      IEnumerable GridData = data;

      int _count = data.Count;

      if (dataManagerRequest.Search != null && dataManagerRequest.Search.Count > 0)

      {

          // Searching

          GridData = DataOperations.PerformSearching(GridData, dataManagerRequest.Search);

      }

      if (dataManagerRequest.Where != null && dataManagerRequest.Where.Count > 0)

      {

          // Filtering

          GridData = DataOperations.PerformFiltering(GridData, dataManagerRequest.Where, dataManagerRequest.Where[0].Operator);

      }

      if (dataManagerRequest.Sorted?.Count > 0) // perform Sorting

      {

          GridData = DataOperations.PerformSorting(GridData, dataManagerRequest.Sorted);

      }

      if (dataManagerRequest.Skip != 0)

      {

          GridData = DataOperations.PerformSkip(GridData, dataManagerRequest.Skip); //Paging

      }

      if (dataManagerRequest.Take != 0)

      {

          GridData = DataOperations.PerformTake(GridData, dataManagerRequest.Take);

      }

      IDictionary<string, object> aggregates = new Dictionary<string, object>();

      if (dataManagerRequest.Aggregates != null) // Aggregation

      {

          aggregates = DataUtil.PerformAggregation(GridData, dataManagerRequest.Aggregates);

      }

      if (dataManagerRequest.Group != null && dataManagerRequest.Group.Any()) //Grouping

      {

          foreach (var group in dataManagerRequest.Group)

          {

              GridData = DataUtil.Group<Student>(GridData, group, dataManagerRequest.Aggregates, 0, dataManagerRequest.GroupByFormatter);

          }

      }

      return dataManagerRequest.RequiresCounts ? new DataResult() { Result = GridData, Count = _count, Aggregates = aggregates } : (object)GridData;

  }



PS Prathap Senthil Syncfusion Team March 20, 2024 10:46 AM UTC

Hi IBS,

Greetings from Syncfusion,

We are unable to reproduce the reported issue when attempting to reproduce the issue in the latest version 25.1.35. For your reference we have attached simple sample. So, to
further proceed with the reporting problem, we require some additional clarification from your end. Please share the below details to proceed further at our end.

  • 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.
  • Could you please share us the video demonstration of the issue with replication steps?
  • If possible, kindly share your attempt to replicate the issue using the attached simple sample.

Above-requested details will be very helpful in validating the reported query at our end and providing a solution as early as possible. Thanks for your understanding.



Regards,
Prathap S


Loader.
Up arrow icon