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

DialogHost not shown when Dialog Content contains ListBox #35

Closed Mrxx99 closed 10 months ago

Mrxx99 commented 11 months ago

I have a minimal sample project where the DialogHost content contains a ListBox and a Button, when the ListBox is there the Dialog is not shown, if the ListBox is not there the Dialog is shown properly.

You can check with the project AvaloniaMatrixInvertIssue_v11 here: https://github.com/Mrxx99/AvaloniaDialogHostAndAsyncImageLoaderIssue

Just lunch the project and click the "Show Dialog" button -> dialog will not show then stop, remove or replace the ListBox and try again -> now it will work

(you can ignore the other projects and the async image loader in the repo as there was initial an issue when both were used together with avalonia 11 preview6)

Bip901 commented 10 months ago

Just experienced the same issue - System.InvalidOperationException is thrown with the message "Transform is not invertible".

This issue is new to the Avalonia 11 release.

Here's a minimal project to reproduce the issue - just run and click the button:

avaloniatest.zip

Screenshot:

Screenshot 2023-08-05 141849

SKProCH commented 10 months ago

When I click the button in all above examples here, I didn't get any exception, seems like because of this weird issue: https://github.com/AvaloniaUI/Avalonia/issues/12388

I'll try to investigate it, but currently I doesn't know how.

SKProCH commented 10 months ago

@Bip901, can you provide an full exception details (or at least stacktrace)?

SKProCH commented 10 months ago

Seems like setting DisableOpeningAnimation="True" for DialogHost will prevent this from appearing.

SKProCH commented 10 months ago

Also, seems like this is related to VirualizingStackPanel, since if we change it to something else (e.g. StackPanel), this works fine:

<ListBox>
  <ListBox.ItemsPanel>
    <ItemsPanelTemplate>
      <VirtualizingStackPanel></VirtualizingStackPanel>
    </ItemsPanelTemplate>
  </ListBox.ItemsPanel>
  <ListBoxItem>test</ListBoxItem>
</ListBox>
SKProCH commented 10 months ago

Fixed with the workaround.

SKProCH commented 10 months ago

Will be available as v0.7.6 on nuget in near future.

Bip901 commented 10 months ago

Awesome, quick fix and detailed explanation - thank you!

Note that I also experienced a hang rather than an exception - I just noticed an InvalidOperationException in the logs so I changed the Visual Studio settings to break on InvalidOperationException. Since it occurs on a background thread, I could resume debugging and also observe that the app keeps running in a frozen state.

SKProCH commented 10 months ago

Strange, but if I set an exception breakpoints in Rider, it doesn't trigger.