MatBlazor icon indicating copy to clipboard operation
MatBlazor copied to clipboard

Toast thread safety

Open simonziegler opened this issue 6 years ago • 4 comments

Hi,

I have a web app (blazor) that is connected to a server via signalr. The web app has a scoped IMatToaster service.

When the app receives two notifications in very quick succession it throws an exception. If I place a lock around the Toast call, the exception goes away. Should IMatToaster be thread safe?

Thanks.

Update: I get lots of Index out of bounds type exceptions when I have multiple simultaneous toasts. If I disable all but one of the notifications (without any other changes to my code), the issue goes away.

Second Update: please see the screen grab below

image

simonziegler avatar Oct 09 '19 10:10 simonziegler

From a user's perspective IMatToaster definitely should be thread safe. Looking at the current implementation you can see it isn't at all. I would grab this issue if I'm allowed to ✌

klemmchr avatar Oct 14 '19 15:10 klemmchr

Hi MatBlazor people. Are you reading these threads? @chris579 identified that my hunch was right about thread safety, but I haven't heard from you here for 3 weeks. Is MatBlazor not supported?

Thanks, Simon

simonziegler avatar Oct 28 '19 14:10 simonziegler

Having the same problem when there are multiple toasts on screen, ArgumentOutOfRangeException happens time to time and crashes everything. I'll just have to remove toasts if this doesn't get fixed soon.

Leafhood avatar Jan 14 '20 06:01 Leafhood

From a user's perspective IMatToaster definitely should be thread safe. Looking at the current implementation you can see it isn't at all. I would grab this issue if I'm allowed to ✌

Found thread safe implementation. Just need to be copied here

azatonskiy avatar Dec 21 '21 07:12 azatonskiy