unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.09k stars 738 forks source link

MessageDialog crashes for Skia.Gtk #10739

Closed rabejens closed 1 year ago

rabejens commented 1 year ago

Current behavior

When using MessageDialog with Skia.Gtk, I get either ArgumentOutOfRangeException or NullReferenceException when trying to show the dialog:

StackTrace of an AOORE:

   at System.ThrowHelper.ThrowArgumentOutOfRange_IndexMustBeLessException()
   at System.Collections.Generic.List`1.Remove(T item)
   at Microsoft.UI.Xaml.UIElement.PointerCapture.RemoveCore(PointerCaptureTarget target, PointerCaptureKind kinds) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.PointerCapture.cs:line 228
   at Microsoft.UI.Xaml.UIElement.PointerCapture.RemoveTarget(UIElement element, PointerCaptureKind kinds, PointerRoutedEventArgs& lastDispatched) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.PointerCapture.cs:line 199
   at Microsoft.UI.Xaml.UIElement.Release(PointerCapture capture, PointerCaptureKind kinds, PointerRoutedEventArgs relatedArgs, Boolean muteEvent) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.Pointers.cs:line 1485
   at Microsoft.UI.Xaml.UIElement.Release(PointerCaptureKind kinds, PointerRoutedEventArgs relatedArgs, Boolean muteEvent) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.Pointers.cs:line 1470
   at Microsoft.UI.Xaml.UIElement.<>c.<.cctor>b__545_5(DependencyObject sender, DependencyPropertyChangedEventArgs dp) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.Pointers.cs:line 220
   at Microsoft.UI.Xaml.DependencyObjectStore.InvokeCallbacks(DependencyObject actualInstanceAlias, DependencyProperty property, DependencyPropertyDetails propertyDetails, Object previousValue, DependencyPropertyValuePrecedences previousPrecedence, Object newValue, DependencyPropertyValuePrecedences newPrecedence, Boolean bypassesPropagation) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 1831
   at Microsoft.UI.Xaml.DependencyObjectStore.RaiseCallbacks(DependencyObject actualInstanceAlias, DependencyPropertyDetails propertyDetails, Object previousValue, DependencyPropertyValuePrecedences previousPrecedence, Object newValue, DependencyPropertyValuePrecedences newPrecedence) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 1755
   at Microsoft.UI.Xaml.DependencyObjectStore.InnerSetValue(DependencyProperty property, Object value, DependencyPropertyValuePrecedences precedence, DependencyPropertyDetails propertyDetails, Boolean isPersistentResourceBinding) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 501
   at Microsoft.UI.Xaml.DependencyObjectStore.CoerceValue(DependencyProperty property) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 583
   at Microsoft.UI.Xaml.FrameworkElement.OnIsEnabledChanged(DependencyPropertyChangedEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\FrameworkElement.cs:line 727
   at Microsoft.UI.Xaml.FrameworkElement.<>c.<CreateIsEnabledProperty>b__435_0(DependencyObject instance, DependencyPropertyChangedEventArgs args) in C:\a\1\s\src\Uno.UI\Uno.UI.SourceGenerators.Internal\Uno.UI.SourceGenerators.DependencyObject.DependencyPropertyGenerator\Microsoft.UI.Xaml.FrameworkElement_d65abd28244c963a4c6c0d4e33cf9c30.cs:line 309
   at Microsoft.UI.Xaml.DependencyObjectStore.InvokeCallbacks(DependencyObject actualInstanceAlias, DependencyProperty property, DependencyPropertyDetails propertyDetails, Object previousValue, DependencyPropertyValuePrecedences previousPrecedence, Object newValue, DependencyPropertyValuePrecedences newPrecedence, Boolean bypassesPropagation) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 1831
   at Microsoft.UI.Xaml.DependencyObjectStore.RaiseCallbacks(DependencyObject actualInstanceAlias, DependencyPropertyDetails propertyDetails, Object previousValue, DependencyPropertyValuePrecedences previousPrecedence, Object newValue, DependencyPropertyValuePrecedences newPrecedence) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 1755
   at Microsoft.UI.Xaml.DependencyObjectStore.InnerSetValue(DependencyProperty property, Object value, DependencyPropertyValuePrecedences precedence, DependencyPropertyDetails propertyDetails, Boolean isPersistentResourceBinding) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 501
   at Microsoft.UI.Xaml.DependencyObjectStore.CoerceValue(DependencyProperty property) in C:\a\1\s\src\Uno.UI\UI\Xaml\DependencyObjectStore.cs:line 583
   at Microsoft.UI.Xaml.FrameworkElement.SuppressIsEnabled(Boolean suppress) in C:\a\1\s\src\Uno.UI\UI\Xaml\FrameworkElement.cs:line 762
   at Microsoft.UI.Xaml.Controls.Primitives.ButtonBase.UpdateCanExecute() in C:\a\1\s\src\Uno.UI\UI\Xaml\Controls\Primitives\ButtonBase\ButtonBase.mux.cs:line 280
   at Microsoft.UI.Xaml.Controls.Primitives.ButtonBase.<OnCommandChanged>g__CanExecuteChangedHandler|77_0(Object sender, Object args) in C:\a\1\s\src\Uno.UI\UI\Xaml\Controls\Primitives\ButtonBase\ButtonBase.mux.cs:line 237
   at ReactiveUI.ReactiveCommandBase`2.OnCanExecuteChanged(Boolean newValue) in /_/src/ReactiveUI/ReactiveCommand/ReactiveCommandBase.cs:line 219
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:line 44
   at System.Reactive.IdentitySink`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Internal/IdentitySink.cs:line 16
   at System.Reactive.Subjects.FastImmediateObserver`1.EnsureActive(Int32 count) in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 907
   at System.Reactive.Subjects.FastImmediateObserver`1.EnsureActive() in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 766
   at System.Reactive.Subjects.ReplaySubject`1.ReplayBase.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 272
   at System.Reactive.Subjects.ReplaySubject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 161
   at System.Reactive.IdentitySink`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Internal/IdentitySink.cs:line 16
   at System.Reactive.Linq.ObservableImpl.DistinctUntilChanged`2._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/DistinctUntilChanged.cs:line 74
   at System.Reactive.Linq.ObservableImpl.CombineLatest`3._.SecondObserver.OnNext(TSecond value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/CombineLatest.cs:line 177
   at System.Reactive.IdentitySink`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Internal/IdentitySink.cs:line 16
   at System.Reactive.Subjects.FastImmediateObserver`1.EnsureActive(Int32 count) in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 907
   at System.Reactive.Subjects.FastImmediateObserver`1.EnsureActive() in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 766
   at System.Reactive.Subjects.ReplaySubject`1.ReplayBase.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 272
   at System.Reactive.Subjects.ReplaySubject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/ReplaySubject.cs:line 161
   at System.Reactive.IdentitySink`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Internal/IdentitySink.cs:line 16
   at System.Reactive.Linq.ObservableImpl.DistinctUntilChanged`2._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/DistinctUntilChanged.cs:line 74
   at System.Reactive.IdentitySink`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Internal/IdentitySink.cs:line 16
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Select.cs:line 48
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 50
   at System.Reactive.Linq.ObservableImpl.Scan`2._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Scan.cs:line 49
   at System.Reactive.SafeObserver`1.WrappingSafeObserver.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Internal/SafeObserver.cs:line 31
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 50
   at System.Reactive.ObserveOnObserverLongRunning`1.Drain() in /_/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs:line 735
   at System.Reactive.ObserveOnObserverLongRunning`1.<>c.<.cctor>b__17_0(ObserveOnObserverLongRunning`1 self, ICancelable cancelable) in /_/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs:line 680
   at System.Reactive.Concurrency.DefaultScheduler.LongRunning.LongScheduledWorkItem`1.<>c.<.ctor>b__3_0(Object thisObject) in /_/Rx.NET/Source/src/System.Reactive/Concurrency/DefaultScheduler.cs:line 182
   at System.Reactive.Concurrency.ConcurrencyAbstractionLayerImpl.<>c.<StartThread>b__8_0(Object itemObject) in /_/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs:line 76

Expected behavior

The dialog should show.

How to reproduce it (as minimally and precisely as possible)

Open a simple Message Dialog:

var md = new MessageDialog("This will crash", "Boom");
await md.ShowAsync();

Workaround

No response

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

No response

Affected platforms

Skia (GTK on Linux/macOS/Windows)

IDE

Visual Studio 2022

IDE version

17.4.3

Relevant plugins

No response

Anything else we need to know?

No response

rabejens commented 1 year ago

Follow up: Seems to be an issue with ReactiveUI