Skip to content

[BUG] Toast randomly not dismissing in Windows #3014

@nk-alex

Description

@nk-alex

Is there an existing issue for this?

  • I have searched the existing issues

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

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:

    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

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

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

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions