Skip to content
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] Remove Windows OnLoaded Popup Workaround #1490

Open
2 tasks done
TheCodeTraveler opened this issue Nov 2, 2023 · 0 comments
Open
2 tasks done

[BUG] Remove Windows OnLoaded Popup Workaround #1490

TheCodeTraveler opened this issue Nov 2, 2023 · 0 comments
Assignees
Labels
area/views Issue/Discussion/PR that has to do with Views blocked bug Something isn't working

Comments

@TheCodeTraveler
Copy link
Collaborator

TheCodeTraveler commented Nov 2, 2023

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

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.

#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

#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: Windows

Anything else?

Adding the blocked label until .NET MAUI Issue dotnet/maui#12970 is resolved

@TheCodeTraveler TheCodeTraveler added bug Something isn't working blocked labels Nov 2, 2023
@TheCodeTraveler TheCodeTraveler self-assigned this Nov 2, 2023
@vhugogarcia vhugogarcia added the area/views Issue/Discussion/PR that has to do with Views label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/views Issue/Discussion/PR that has to do with Views blocked bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants