AvaloniaUtils / DialogHost.Avalonia

AvaloniaUI control that provides a simple way to display a dialog with information or prompt the user when information is needed
MIT License
228 stars 15 forks source link

Does not work correctly on iOS #41

Closed alessandrofrancesconi closed 5 months ago

alessandrofrancesconi commented 5 months ago

I'm using DialogHost.Avalonia 0.7.7 for an app project targeting both Android and iOS. Avalonia framework version is 11.0.6 and .NET version is 7.

Please check the attached sample project. It simply opens a message dialog (MessageDialog.xaml) when clicking the Button.

Running in Debug mode, it works as expected on Android 11. Instead on iOS (different devices from version 15.8 to 16.2) the popup does not open, or it takes a very long time.

Sorry but I cannot test in Release mode as for now, so I cannot tell you if this is related to a particular Configuration.

PopupTest.zip

SKProCH commented 5 months ago

Hello, @alessandrofrancesconi

I'll try to debug this, but I don't own physical iOS device, so only emulator available. If you find any details - please let me know.

alessandrofrancesconi commented 5 months ago

I'm testing on multiple iOS Simulators, and 1 real device. The issue is present in both conditions.

alessandrofrancesconi commented 5 months ago

Just tested in Release mode and the issue remains. It seems that, only on iOS, it is necessary to start tapping at the center of the screen to let the popup appear.

To add more details, I'm using the following version of Microsoft.iOS: 16.2.2054 / 7.0.100. I am not able to upgrade to a more recent version because I'm using Xcode 14.2 and cannot upgrade.

To test it with this very same version, add the following files to the root of the sample project:

global.json

{
  "sdk": {
    "version": "7.0.100",
    "rollForward": "disable",
    "allowPrerelease": false
  }
}

rollback.json

{
  "microsoft.net.sdk.ios": "16.2.2054/7.0.100"
}

Before compiling, run this:

dotnet workload uninstall ios
dotnet workload install ios --from-rollback-file rollback.json

Let me know if you can reproduce it, thanks!

SKProCH commented 5 months ago

Hmm, okay, thanks.

Can you also try to disabling animations from DialogHost. May be it will help?

alessandrofrancesconi commented 5 months ago

Can you also try to disabling animations from DialogHost. May be it will help?

Already tried with no improvements

SKProCH commented 5 months ago

I tried to begin to determine the cause of the error, downloaded your project, and suddenly realized that the rider could not run it.

After a quick search on the Internet, I realized that without having any Apple device (Mac or iPhone), I cannot somehow launch the application. As I understand it, it is impossible to run an iPhone emulator (or some similarity) if you only have Linux/Windows/Android devices.

Perhaps I missed something and this is not true?

SKProCH commented 5 months ago

Also, one of Avalonia maintainers suggesting you to try latest nightly avalonia build. I think than they fix something continuously, and this bug probably on Avalonia side (since it works everywhere except iOS).

alessandrofrancesconi commented 5 months ago

Just tested Avalonia nightly 11.0.999, but the issue remains. I can tell you that, once you click on the "Show popup" button in the project, I have to tap the center of the screen in order to make the popup appear. Seems that the popup is actually there, but invisible. A tap over it will make it appear.

And yes, in order to launch the app on a iOS Device, or an iOS Simulator, you must have an Apple machine paired with your main development PC.

Some links about this limitation:

Is there something I can do to help you debug this?

SKProCH commented 5 months ago

You're probably not going to gift me an Apple machine to debug this bug 😄...

So, probably not. I'll try to set aside time on the weekends to install and configure macos on a virtual machine, but I think it will take a while.

If you really want to - you can look how the library works, try to recreate a minimal working library and figure out the point at which it stops working. At least I think that's the way I would pick to figure out what's going wrong. But I also think that you don't have the time and/or desire to look into it.

So, keep me informed if you can find out anything.

SKProCH commented 5 months ago

It might also be worth trying to create dialogue content that manually sets changing Height/Width using a timer. Thus, Avalonia will have to redraw its contents - then, perhaps, the dialog will appear automatically after Avalonia redraws it. If so, maybe we'll get closer to understanding what the problem might be.

Also, seems like 11.0.7 version of Avalonia just released. Can you try it too?

alessandrofrancesconi commented 5 months ago

After upgrading to Avalonia 11.0.7 (released 32 minutes ago!) it worked! I don't know why the nightly did not solve...

SKProCH commented 5 months ago

Wow, that's wonderful!