-
-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Labels
BugSomething isn't workingSomething isn't workingTriageIssue needs to be triagedIssue needs to be triaged
Description
Describe the bug
When invoking any IToastService.ShowXYZ
method from a DelegatingHandler in a Blazor WebAssembly environment, the result is that no toast is shown in the UI.
To Reproduce
Steps to reproduce the behavior:
- Clone the minimal repro repository: https://github.com/Noveboi/BlazoredToastDelegatingHandlers
- Run the app
- Click the "Show Toast" button to ensure that toasts are shown in a regular scenario
- Click the "Call HttpClient" button to see that no toasts are shown
- Open browser console to find the log that shows the
DelegatingHandler
is actually being invoked.

Expected behavior
Two info toasts should appear, one when the request is sent and one when the response is received. Take a look at the DelegatingHandler
's code to see exactly what should happen:
internal sealed class HttpNotificationMiddleware(
IToastService toast,
ILogger<HttpNotificationMiddleware> log) : DelegatingHandler
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
log.LogInformation("To verify the handler is actually being run!");
toast.ShowInfo("Sending request!");
var response = await base.SendAsync(request, cancellationToken);
toast.ShowInfo("Got response!");
return response;
}
}
Hosting Model (is this issue happening with a certain hosting model?):
Blazor WebAssembly
Additional context
I will post comments if I find anything useful
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workingTriageIssue needs to be triagedIssue needs to be triaged