-
Notifications
You must be signed in to change notification settings - Fork 487
Closed
Labels
area/viewsIssue/Discussion/PR that has to do with ViewsIssue/Discussion/PR that has to do with ViewsbugSomething isn't workingSomething isn't workingunverified
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
It seems like a Popup.CloseAsync() call can cause a UIThread issue when running on iOS. It runs fine on Android and if anything, I would assume this exception already when trying to display the Popup (as this is in the same async Task method in my case).
Expected Behavior
Popup.CloseAsync() makes sure it runs on the proper thread.
Steps To Reproduce
Not sure how much I would need to remove from my code to make this happen. This method is invoked from the constructor of the page:
public async Task LoadDataWithKey(string? key)
{
LoadingPopup? loadingPopup = null;
try
{
loadingPopup = new LoadingPopup { Message = AppResources.DefaultText_Loading };
Shell.Current.ShowPopup(loadingPopup);
var allCategories = await speedrunCategoryDatabaseRepository.GetAllAsync();
Category = allCategories.First(c => c.Key == key)!;
Entries = (await apiRepository.GetEntriesAsync(_category).ConfigureAwait(false))
.Select(e => new SpeedrunEntryWrapperViewModel(e)).ToArray();
}
catch (Exception e)
{
logger.LogError(e, e.Message);
}
finally
{
if (loadingPopup != null)
{
await loadingPopup.CloseAsync();
loadingPopup.DisposeIfDisposable();
}
}
}
Link to public reproduction project repository
n/a
Environment
- .NET MAUI CommunityToolkit: 11.0.0
- OS: Windows 11 / iOS 16 as Debug Target
- .NET MAUI: 9Anything else?
I know that I did not attached a reproduction project because I do not know yet how to isolate the issue so far that it's an issue. I just found out that on iOS I have to sent the Popup.CloseAsync() to the MainThread manually for my app to no longer crash with this exception.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/viewsIssue/Discussion/PR that has to do with ViewsIssue/Discussion/PR that has to do with ViewsbugSomething isn't workingSomething isn't workingunverified