Repository navigation
Closed
Labels
area/viewsIssue/Discussion/PR that has to do with ViewsIssue/Discussion/PR that has to do with ViewsblockedbugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- 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
In PR #1470, we added the below work-arounds for Popup on Windows to fix a .NET MAUI bug affecting Popup.
Once the .NET MAUI team has resolved dotnet/maui#12970, we will remove our work-around.
Maui/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.shared.cs
Lines 24 to 50 in 5a4f7ea
| #if WINDOWS | |
| // TODO: This is a workaround for https://github.com/dotnet/maui/issues/12970. Remove this `#if Windows` block when the issue is closed | |
| void handler(object? sender, EventArgs args) | |
| { | |
| page.GetCurrentPage().Loaded -= handler; | |
| CreateAndShowPopup(page, popup); | |
| } | |
| page.GetCurrentPage().Loaded += handler; | |
| #else | |
| if (page.IsPlatformEnabled) | |
| { | |
| CreateAndShowPopup(page, popup); | |
| } | |
| else | |
| { | |
| void handler(object? sender, EventArgs args) | |
| { | |
| page.Loaded -= handler; | |
| CreateAndShowPopup(page, popup); | |
| } | |
| page.Loaded += handler; | |
| } | |
| #endif |
Maui/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.shared.cs
Lines 67 to 118 in 5a4f7ea
| #if WINDOWS | |
| // TODO: This is a workaround for https://github.com/dotnet/maui/issues/12970. Remove this `#if Windows` block when the issue is closed | |
| var taskCompletionSource = new TaskCompletionSource<object?>(); | |
| async void handler(object? sender, EventArgs args) | |
| { | |
| page.GetCurrentPage().Loaded -= handler; | |
| try | |
| { | |
| var result = await CreateAndShowPopupAsync(page, popup); | |
| taskCompletionSource.TrySetResult(result); | |
| } | |
| catch (Exception ex) | |
| { | |
| taskCompletionSource.TrySetException(ex); | |
| } | |
| } | |
| page.GetCurrentPage().Loaded += handler; | |
| return taskCompletionSource.Task; | |
| #else | |
| if (page.IsPlatformEnabled) | |
| { | |
| return CreateAndShowPopupAsync(page, popup); | |
| } | |
| else | |
| { | |
| var taskCompletionSource = new TaskCompletionSource<object?>(); | |
| async void handler(object? sender, EventArgs args) | |
| { | |
| page.Loaded -= handler; | |
| try | |
| { | |
| var result = await CreateAndShowPopupAsync(page, popup); | |
| taskCompletionSource.TrySetResult(result); | |
| } | |
| catch (Exception ex) | |
| { | |
| taskCompletionSource.TrySetException(ex); | |
| } | |
| } | |
| page.Loaded += handler; | |
| return taskCompletionSource.Task; | |
| } | |
| #endif |
Expected Behavior
The .NET MAUI team have an open Issue to address this
Steps To Reproduce
N / A
Link to public reproduction project repository
https://github.com/CommunityToolkit/Maui
Environment
- .NET MAUI CommunityToolkit: v6.1.0
- OS: WindowsAnything else?
Adding the blocked label until .NET MAUI Issue dotnet/maui#12970 is resolved
Metadata
Metadata
Assignees
Labels
area/viewsIssue/Discussion/PR that has to do with ViewsIssue/Discussion/PR that has to do with ViewsblockedbugSomething isn't workingSomething isn't working
Activity