You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
- .NET MAUI CommunityToolkit: 11.0.0
- OS: Windows 11 / iOS 16 as Debug Target
- .NET MAUI: 9
Anything 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.
The text was updated successfully, but these errors were encountered:
@Sebastian1989101 I see that you're using the ConfigureAwait(false) on your code... That will make all code bellow to be executed in any thread, so that probably is the root cause. I'm not sure why there's a difference between ios and android, but removing that ConfigureAwait should do the job... Or queue the CloseAsync method to run on UIThread, you can use the MainThread class for it
@pictos already sending it to the main thread. Was not an issue for me to get rid of the error, however I think a control should always self check to be on the proper thread (at least bindings and other controls from MAUI itself do this).
@Sebastian1989101, I somewhat disagree with that. If you try to force a control to update outside the UI thread, it will throw an exception. This is common sense in most UI frameworks, even on the native side. The app developer should take care of the threads.
As a result, you will face this exception, proving my point that it is the responsibility of the app developer to ensure the code runs on the correct thread.
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
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:
Link to public reproduction project repository
n/a
Environment
Anything 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.
The text was updated successfully, but these errors were encountered: