-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [Windows] The second popup will fail to show after MAUI 8.0.60 #1931
Comments
Tracked this issue down to the Loaded event not getting triggered, resulting in the taskCompletionSource not completing, which will keep the task running. Maui/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.shared.cs Lines 62 to 81 in 442f39e
Think this issue is caused by this fix dotnet/maui@21620dc which is included in 9.0.0-preview.5.24307.10 and 8.0.60 This is not an issue on Android. Didn't test on other platforms. |
Issue is fixed if the Unload event is set too. var taskCompletionSource = new TaskCompletionSource<object?>();
void unloadedHandler(object? sender, EventArgs args) => {};
async void loadedHandler(object? sender, EventArgs args)
{
page.GetCurrentPage().Unloaded -= unloadedHandler;
page.GetCurrentPage().Loaded -= loadedHandler;
try
{
var result = await CreateAndShowPopupAsync(page, popup, token);
taskCompletionSource.TrySetResult(result);
}
catch (Exception ex)
{
taskCompletionSource.TrySetException(ex);
}
}
page.GetCurrentPage().Unloaded += unloadedHandler;
page.GetCurrentPage().Loaded += loadedHandler;
return taskCompletionSource.Task.WaitAsync(token); |
Any chance the issue relates to this microsoft/microsoft-ui-xaml#1900 |
This fix should be available on the nightly feed as version Can you test with the latest nightly build? |
Hi @PureWeen, Just tried the nightly build and it indeed fixes the issue. |
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
This is a very strange issue. Since MAUI version 8.0.60 the second popup will fail. Only the second time you want to show a popup will fail. The popup will not show up and if you are using CommunityToolkit.MVVM [RelayCommand] the button (triggering the popup) will be disabled, because the Task will not return. See video of the problem.
Every_second_popup_via_popupservice_fails.mp4
Expected Behavior
The popup should always be shown also the second popup.
Steps To Reproduce
Link to public reproduction project repository
https://github.com/CommunityToolkit/Maui
Environment
Anything else?
To prevent the button from disabling while using CommunityToolkit.MVVM is to use [RelayCommand(AllowConcurrentExecutions = true)] instead of [RelayCommand]
The text was updated successfully, but these errors were encountered: