amwx / FluentAvalonia

Control library focused on fluent design and bringing more WinUI controls into Avalonia
MIT License
1.05k stars 97 forks source link

[Bug?] System.DivideByZeroException: 'Attempted to divide by zero.' when opening FAComboBox inside PropertyGrid #529

Closed artizzq closed 8 months ago

artizzq commented 8 months ago

Discussed in https://github.com/amwx/FluentAvalonia/discussions/528

Originally posted by **artizzq** February 28, 2024 I have properties inside PropertyGrid (https://github.com/bodong1987/Avalonia.PropertyGrid) and for choice and setting some properties I use control like FAComboBox. ![image](https://github.com/amwx/FluentAvalonia/assets/56273839/21045894-e6c3-4d57-8ea3-50f16f43fe8c) When I try to open combobox (any of them inside PropertyGrid) program breaks on exception. ![image](https://github.com/amwx/FluentAvalonia/assets/56273839/ee1962ee-947d-4e5f-9e9d-2cdbfb1d2a6f) Screencast: ![problem](https://github.com/amwx/FluentAvalonia/assets/56273839/a35b71cf-fafe-46d7-beb6-4b5e544c8180) XAML ``` ... ``` Code (inside Class that inherited AbstractCellEditFactory) ``` - ``` The stack trace is ``` at Avalonia.Controls.LayoutTransformControl.ComputeLargestTransformedSize(Size arrangeBounds) at Avalonia.Controls.LayoutTransformControl.MeasureOverride(Size availableSize) at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) at Avalonia.Layout.Layoutable.Measure(Size availableSize) at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize) at Avalonia.Controls.Primitives.PopupRoot.MeasureOverride(Size availableSize) at Avalonia.Controls.WindowBase.MeasureCore(Size availableSize) at Avalonia.Layout.Layoutable.Measure(Size availableSize) at Avalonia.Layout.LayoutManager.Measure(Layoutable control) at Avalonia.Layout.LayoutManager.ExecuteInitialLayoutPass() at Avalonia.Controls.WindowBase.Show() at Avalonia.Controls.Primitives.Popup.Open() at Avalonia.Controls.Primitives.Popup.IsOpenChanged(AvaloniaPropertyChangedEventArgs`1 e) at Avalonia.Controls.Primitives.Popup.<>c.<.cctor>b__21_1(Popup x, AvaloniaPropertyChangedEventArgs e) at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value) at Avalonia.PropertyStore.EffectiveValue`1.SetAndRaiseCore(ValueStore owner, StyledProperty`1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue) at Avalonia.PropertyStore.EffectiveValue`1.SetAndRaise(ValueStore owner, IValueEntry value, BindingPriority priority) at Avalonia.PropertyStore.ValueStore.ReevaluateEffectiveValue(AvaloniaProperty property, EffectiveValue current, IValueEntry changedValueEntry, Boolean ignoreLocalValue) at Avalonia.PropertyStore.BindingEntryBase`2.g__Execute|37_0(BindingEntryBase`2 instance, BindingValue`1 value) at Avalonia.PropertyStore.BindingEntryBase`2.SetValue(BindingValue`1 value) at Avalonia.PropertyStore.BindingEntryBase`2.OnNext(TSource value) at Avalonia.Data.TemplateBinding.PublishValue() at Avalonia.Data.TemplateBinding.TemplatedParentPropertyChanged(Object sender, AvaloniaPropertyChangedEventArgs e) at Avalonia.PropertyStore.EffectiveValue`1.SetAndRaiseCore(ValueStore owner, StyledProperty`1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue) at Avalonia.PropertyStore.ValueStore.SetLocalValue[T](StyledProperty`1 property, T value) at Avalonia.PropertyStore.ValueStore.SetValue[T](StyledProperty`1 property, T value, BindingPriority priority) at Avalonia.AvaloniaObject.SetValue[T](StyledProperty`1 property, T value, BindingPriority priority) at FluentAvalonia.UI.Controls.FAComboBox.set_IsDropDownOpen(Boolean value) at FluentAvalonia.UI.Controls.FAComboBox.OnPointerReleased(PointerReleasedEventArgs e) at Avalonia.Input.InputElement.<>c.<.cctor>b__32_9(InputElement x, PointerReleasedEventArgs e) at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value) at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers, IInputElement hitTest) at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e) at Avalonia.Win32.WindowImpl.AppWndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) at Avalonia.Win32.WindowImpl.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg) at Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken) at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl) at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode) at .Program.Main(String[] args) in D:\\\\Program.cs:line 8 ```
artizzq commented 8 months ago

I noticed same behaviour using plain ComboBox from Avalonia.

artizzq commented 8 months ago

Somehow external DLL library I connected on viewmodel init messed up all my control interaction so any action like scrolling, clicking ended up like this. Problem solved.