"Event already tracked" error after deleting a record from a SfGrid's data source

When deleting an record from an SfGrid's data source, an exception is thrown when the grid gets re-rendered. I am basically calling a method removing the currently selected item from the grids data source when a button in that item's grid row gets clicked.


Error Message:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Event 1525 is already tracked
Error: Event 1525 is already tracked
at e.update (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:42982)
at e.setListener (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:40575)
at e.applyAttribute (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:36864)
at e.applyEdits (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:33290)
at e.updateComponent (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:32271)
at Object.t.renderBatch (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:12134)
at Object.window.Blazor._internal.renderBatch (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:61913)
at Object.w [as invokeJSFromDotNet] (https://localhost:44361/StreckerShop/_framework/blazor.webassembly.js:1:64435)
at _mono_wasm_invoke_js_blazor (https://localhost:44361/StreckerShop/_framework/dotnet.5.0.13.js:1:190800)
at wasm_invoke_iiiiii (wasm://wasm/00aba242:wasm-function[5611]:0xdda7f)

HTML

<SfGrid @ref="palettenGrid" TValue="VersandPalettenInfo" DataSource="@palettenListe" EnableVirtualization="true" EnableVirtualMaskRow="true" AllowSorting="false" AllowFiltering="false" Height="180" RowHeight="20">
<GridPageSettings PageSize="100"></GridPageSettings>
<GridColumns>
<GridColumn Width="50" TextAlign="TextAlign.Center">
<Template>
<i class="fas fa-trash-alt" style="color: #0;" @onclick='() => OnDelPalette((context as VersandPalettenInfo).Key)' />
</Template>
</GridColumn>
<GridIntegerColumn HeaderText="Anzahl" Field=@nameof(VersandPalettenInfo.Anzahl) Width="120" HeaderToolTip="Anzahl Paletten" HeaderTextAlign="TextAlign.Center" TextAlign="TextAlign.Center"> </GridIntegerColumn>
<GridIntegerColumn HeaderText="Gewicht (kg)" Field=@nameof(VersandPalettenInfo.Gewicht) Width="120" HeaderToolTip="Gesamtgewicht [kg]" HeaderTextAlign="TextAlign.Center" TextAlign="TextAlign.Center"></GridIntegerColumn>
</GridColumns>
</SfGrid>

Data Types

    [Table("TAB_SPEDITIONSVERSAND")]
public partial class TAB_SPEDITIONSVERSAND
{
[Key]
[StringLength(3)]
public string PALETTENTYP { get; set; } = "";
public int LAENGE_CM { get; set; }
public int BREITE_CM { get; set; }
public int HOEHE_CM { get; set; }
[StringLength(2000)]
public string TEXT { get; set; } = "";
}


public class VersandPalettenInfo
{
public VersandPalettenInfo()
{
Info = new();
}
public VersandPalettenInfo(TAB_SPEDITIONSVERSAND i)
{
Info = i;
}
public TAB_SPEDITIONSVERSAND Info { get; set; }
public int Anzahl { get; set; } = 1;
public float Volumen => (float)(Laenge * Breite * Hoehe) / 1e6f;
public string Typ => Info.PALETTENTYP;
public int Laenge => Info.LAENGE_CM;
public int Breite => Info.BREITE_CM;
public int Hoehe => Info.HOEHE_CM;
public string Text => Info.TEXT;
}

Code

    SfGrid palettenGrid;

public List palettenTypen = null;
public TAB_SPEDITIONSVERSAND palettenTyp = new();
protected ObservableCollection palettenListe = new ObservableCollection();


void OnDelPalette(int key)

{
int i = 0;
foreach (VersandPalettenInfo pi in palettenListe)
{
if (pi.Key == key)
{
palettenKeys.ReleaseKey(pi.Key);
palettenListe.RemoveAt(i);
break;
}
i++;
}
StateHasChanged();
}


public void Setup ()
{
if (palettenTypen is null)
{
palettenTypen = new();
foreach (TAB_SPEDITIONSVERSAND p in SpeditionsversandCache.ValuesList)
palettenTypen.Add(p);
}
if (palettenListe.Count > 0)
palettenListe.Clear();
palettenListe.Add(new VersandPalettenInfo(palettenTypen [0]));
}





4 Replies

DM Dietfrid Mali March 8, 2022 12:59 PM UTC

Update: The exception only occurs when I delete the last (at the end of the list, not the last remaining) record of the data source. However, the deletion operation itself seems to be in order; The correct last item of the data source is getting removed from the underlying data structure (ObservableCollection).



RN Rahul Narayanasamy Syncfusion Team March 8, 2022 04:59 PM UTC

Hi Dietfrid, 

Greetings from Syncfusion. 

Based on your shared details, we have checked the reported problem. We are able to reproduce the reported problem while clicking(deleting) the last record of the Grid(in Webassembly) in .Net 5.0. We suspect that the reported problem was due to .Net 5.0 TargetFramework. When checking the same case in .Net 6.0 TargetFramework, the reported problem was not occurred. Could you please ensure the reported problem after upgrading to .Net 6.0 TargetFramework from your end? 


Please let us know if you have any concerns. 

Regards, 
Rahul  
 



DM Dietfrid Mali March 9, 2022 02:46 AM UTC

Unfortunately, we cannot currently upgrade our application to .Net 6 due to two other components still relying on .Net 5. 



VN Vignesh Natarajan Syncfusion Team March 9, 2022 12:38 PM UTC

Hi Dietfrid,  

Thanks for the update.  

As mentioned in the previous update, the reported issue is related to Blazor Framework. The reported issue is a known from their side and they have fixed the issue in dotnet 6.0. Please find some general issue related to this topic and Microsoft has fixed this issue in Dot Net 6.0. 


Since it is framework related issue, we do not have a workaround or an alternative solution to overcome this issue. So we reuqest you to  kindly upgrade to the latest version to resolve the reported issue.  

Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon