smapiot / Piral.Blazor

All .NET things to make Blazor work seamlessly in microfrontends using Piral. :jigsaw:
https://piral.io
MIT License
55 stars 17 forks source link

Uncaught Error: Collection was modified #127

Closed anders130 closed 11 months ago

anders130 commented 11 months ago

Bug Report

Environment Details and Version

Description

Everytime, a PiletService Method is executed, the following error message appears inside the browser console:

Uncaught (in promise) Error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator[[Piral.Blazor.Core.PiletService.EventListener, Piral.Blazor.Core, Version=7.0.9.0, Culture=neutral, PublicKeyToken=null]].MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator[[Piral.Blazor.Core.PiletService.EventListener, Piral.Blazor.Core, Version=7.0.9.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Piral.Blazor.Core.PiletService.CallEventListeners(String type, JsonElement args) in /home/vsts/work/1/s/src/Piral.Blazor.Core/PiletService.cs:line 142
   at Piral.Blazor.Core.JSBridge.ProcessEvent(String type, JsonElement args) in /home/vsts/work/1/s/src/Piral.Blazor.Core/JSBridge.cs:line 110
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
    at Object.endInvokeDotNetFromJS (blazor.webassembly.js:1:3549)
    at Object.Xt [as endInvokeDotNetFromJS] (blazor.webassembly.js:1:63263)
    at Object.Gt [as invokeJSFromDotNet] (blazor.webassembly.js:1:62760)
    at Object.Ii (dotnet.7.0.12.f0vb2lepsw.js:5:71974)
    at _mono_wasm_invoke_js_blazor (dotnet.7.0.12.f0vb2lepsw.js:14:103886)
    at 00993936:0x1d6b8
    at 00993936:0x1cae6
    at 00993936:0xe1d6
    at 00993936:0xd046
    at 00993936:0x1a2379

Steps to Reproduce

  1. clone my repo on dev branch (https://github.com/anders130/piral-distributed-example/tree/dev)
  2. build the app-shell
  3. build the solution
  4. debug the BlazorPilet.Counter2 project
  5. navigate to the counter2 page and click the button with browser console enabled

Actual behavior

Executing any PiletService-Method triggers the error but the functionality seems to work regardless.

FlorianRappl commented 11 months ago

Thanks for the report. Fixed and will be part of the next release.