Exception on Edit blazor Grid

I have tried to implement a simple Create Edit Detele 

everything work fine except for Edit; when i click on Edit i receive an exception and application stop working

Stack overflow.
   at System.RuntimeTypeHandle.GetInstantiation(System.Runtime.CompilerServices.QCallTypeHandle, System.Runtime.CompilerServices.ObjectHandleOnStack, BOOL)
   at System.RuntimeTypeHandle.GetInstantiationPublic()
   at System.RuntimeType.GetGenericArguments()
   at System.RuntimeType.MakeGenericType(System.Type[])
   at Breeze.Sharp.Core.TypeFns.CreateGenericInstance(System.Type, System.Type[])
   at Breeze.Sharp.EntityAspect.<InitializeDefaultValues>b__71_1(Breeze.Sharp.NavigationProperty)
   at Breeze.Sharp.Core.EnumerableFns.ForEach[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>, System.Action`1<System.__Canon>)
   at Breeze.Sharp.EntityAspect.InitializeDefaultValues()
   at Breeze.Sharp.EntityAspect..ctor(Breeze.Sharp.IEntity)
   at Breeze.Sharp.BaseEntity..ctor()
   at PVTechSuite.Shared.Dto.Db.ApplicationUser..ctor()
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean, Boolean, Boolean)
   at System.Activator.CreateInstance(System.Type, Boolean, Boolean)
   at Syncfusion.Blazor.Grids.Internal.ReflectionExtension.TryCreateInstance(System.Type)
   at Syncfusion.Blazor.Grids.Internal.Edit`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Clone(System.Object, System.Type)
   at Syncfusion.Blazor.Grids.Internal.Edit`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Clone(System.Object, System.Type)
   at Syncfusion.Blazor.Grids.Internal.Edit`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Clone(System.Object, System.Type)
   at Syncfusion.Blazor.Grids.Internal.Edit`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Clone(System.Object, System.Type)
   at Syncfusion.Blazor.Grids.Internal.Edit`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Clone(System.Object, System.Type)

 


<SfGrid ID="Grid" DataSource="@regions" @ref="Grid" AllowPaging="true" AllowFiltering="true" AllowReordering="true" AllowResizing="true" AllowGrouping="true" AllowExcelExport="true" AllowSelection="true"
        AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update","ExcelExport","Search"})" >
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" ShowConfirmDialog="true" Mode="EditMode.Normal"></GridEditSettings>
    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.FilterBar"></GridFilterSettings>
    <GridSelectionSettings PersistSelection="true" EnableSimpleMultiRowSelection="true" Type="SelectionType.Multiple" Mode="Syncfusion.Blazor.Grids.SelectionMode.Row" />
    <GridPageSettings PageSizes="true"></GridPageSettings>
    <GridEvents OnActionBegin="OnBeginHandler" OnToolbarClick="ToolbarClick" TValue="Region"></GridEvents>
    <GridColumns>
        <GridColumn Field=@nameof(Region.Id) HeaderText="ID" IsPrimaryKey="true" Visible="false" IsIdentity="true" ValidationRules="@(new ValidationRules{ Required=true })" TextAlign="TextAlign.Right" Width="120"></GridColumn>
        <GridColumn Field=@nameof(Region.Name) HeaderText="Name" ValidationRules="@(new ValidationRules{ Required=true })" Width="120"></GridColumn>
        <GridColumn Field=@nameof(Region.Description) HeaderText="Description" ValidationRules="@(new ValidationRules{ Required=false })" Width="120"></GridColumn>
    </GridColumns>
</SfGrid>




3 Replies

RS Renjith Singh Rajendran Syncfusion Team January 25, 2021 12:31 PM UTC

Hi Ibrahim, 

Greetings from Syncfusion support. 

We are not clear about the exact scenario you are facing this reported problem. We tried reproduce the exception by creating a sample based on your shared codes in our latest version 18.4.0.35. But we could not face any exception when editing in Grid. We are attaching the sample for your reference, please download the sample from the link below, 

Kindly refer the above attached sample and if you are still facing difficulties, then kindly get back to us with the following details for better assistance. 

  1. Share with us a simple issue reproducing sample for us to validate based on your scenario.
  2. Or if possible, reproduce the problem with the above attached sample and share with us for further analysis.
  3. Share with us a video showing the replication of the problem you are facing.
  4. Share with us the exact scenario or proper replication procedure to reproduce the problem.

The provided information will help us analyze the problem, and provide you a solution as early as possible. 

Regards, 
Renjith Singh Rajendran 



IB Ibrahim January 26, 2021 08:16 PM UTC

Hello;

please find attached a simple reproducing the issue; the error happens when you hit Edit  on Todo List  page 

Regards

Attachment: gridissue_1dad4183.zip


RS Renjith Singh Rajendran Syncfusion Team February 5, 2021 10:51 AM UTC

Hi Ibrahim, 

We are facing dependency issues when try running your shared application. So, we have analyzed the codes you have used in the shared application. We suspect that the reported problem occurred because of having the CreatedBy column in Grid. As the type for CreatedBy is a class ApplicationUser, we suspect that this is a complex typed column which you have bound in Grid. 

To bind complex typed data to Grid, it is recommended to follow the below documentation, 

So please use the above way to bind complex typed data in Grid. And if you are still facing difficulties or if we have misunderstood the scenario, then kindly share with us the details to proceed further. 

  1. Please check this case by removing CreatedBy column and try reproducing the exception on editing.
  2. Share with us a video demo showing the types of data you will be binding in Grid.

And also please bind the “OnActionFailure” event to Grid. This event will be triggered for every failure in Grid. Please share the details you get in the “args” of this event handler for further analysis.  

Regards, 
Renjith R 


Loader.
Up arrow icon