CommunityToolkit / CommunityToolkit/Maui

[BUG] Toast randomly not dismissing in Windows

Open
#3,014 0 comments 0 reactions 0 assignees View on GitHub
bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

I have an application using `CommunityToolkit.Maui.Alerts.Toast` displaying important information for the user. In my case it's mandatory to dismiss the current showig `Toast` when a new `Toast` is ready to be shown.

From docs:
> You can display only one Toast at a time. If you call the Show method a second time, the first Toast will automatically be dismissed.

The problem seems to be having a maximum time to dismiss a `Toast`. If that time passes, that `Toast` won't be dismissed. Even if you manually try to:

```c#
if (Toast != null)
{
await Toast.Dismiss();
Toast.Dispose();
}

Toast = CommunityToolkit.Maui.Alerts.Toast.Make($"Clicked {NumberOfClicks} times!", ToastDuration.Short);
await Toast.Show();
```
Here a gif showing the current behaviour from my sample application:

![Image](https://github.com/user-attachments/assets/8440e4d2-e577-43b8-a521-5972838cc247)

The sample just counts the number of clicks and displays it using `Toast`. When I hit **119** clicks, I wait long enough to not be able to dismiss the `Toast`. Not even manually.

### Expected Behavior

To be able to dismiss the current `Toast` whenever I need to show a new one.

### Steps To Reproduce

1. Open solution from reproduction project repository.
2. You'll find just a page with two buttons. `Show toast` (just shows a new `Toast`) and `Manually dismiss and show toast` (manually dismiss current `Toast` and shows a new one).
3. Follow the attached gif. Just click one button and wait long enough to click it again. After that you will be able to click multiple times either one of them and new `Toast` won't show.

### Link to public reproduction project repository

https://github.com/nk-alex/CameraView/tree/feature/Toast_Bug

### Environment

```markdown
- .NET MAUI CommunityToolkit: 13.0.0
- OS: Windows 11
- .NET MAUI: .net 10
```

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with CommunityToolkit.Maui.Alerts.Toast and reproduce the behavior on Windows 11 using the linked CameraView reproduction project. Compare automatic timeout dismissal with the manual Dismiss and Dispose calls, then verify that repeated clicks can dismiss the current toast and show a new one.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.