Closed dfkeenan closed 4 years ago
Same here,
Here a await Task.Yield (); just after the Modal await, probably await dialog.Result, (temporary) solves the problem.
Could you provide some clear steps to reproduce this issue, or a repo showing this problem?
This is the simplest project using default Blazor wasm template, hope this help, just press "TEst Modal" button.
Ah Right, I may be getting what is going wrong. I will try some stuff to see if I can fix it.
EDIT: Forgot to mention what I think is the problem: The NavigationManager is navigating away from the page, which causes all modals on screen to be closed. Only problem is, the modal is already being closed by BlazoredModal.Close. Thus, while closing all modals, the collection of modals changes which causes this problem.
I can reproduce it in the sample project as well. I might have a fix for it, so I will make a PR so we can all review it.
Describe the bug After updating from 5.0.2 to 5.0.3 I started getting
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
Happens in theBlazored.Modal.BlazoredModal.CancelModals
method.To Reproduce Steps to reproduce the behavior:
Expected behavior Not throw exception
Screenshots If applicable, add screenshots to help explain your problem.
Hosting Model (is this issue happening with a certain hosting model?): I am currently using
Additional context I am using the
CEC.Routing
package to prevent users from navigating with unsaved changes. The modal is being shown upon navigation.