Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPF] PropertyGrid Crash with Dictionary #2634

Open
SlowLogicBoy opened this issue Mar 21, 2024 · 0 comments
Open

[WPF] PropertyGrid Crash with Dictionary #2634

SlowLogicBoy opened this issue Mar 21, 2024 · 0 comments

Comments

@SlowLogicBoy
Copy link
Contributor

Expected Behavior

List dictionary values

Actual Behavior

Form crashes

Steps to Reproduce the Problem

  1. Run the code provided below
  2. Press this:

image

  1. App crashes
Exception
Eto.Forms.PropertyBindingException: Could not get property 'Value' on 'Eto.Forms.ThemedControls.ThemedPropertyGrid+PropertyItem'
 ---> System.Reflection.TargetInvocationException: Property accessor 'Value' on object 'Eto.Forms.ThemedControls.ThemedPropertyGrid+PropertyItem' threw the following exception:'Parameter count mismatch.'
 ---> System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at void System.Reflection.MethodBaseInvoker.ThrowTargetParameterCountException()
   at object System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
   at object System.Reflection.PropertyInfo.GetValue(object obj)
   at object Eto.PropertyInfoDescriptor.GetValue(object obj)
   at object Eto.Forms.ThemedControls.ThemedPropertyGrid+PropertyItem.GetPropertyValue(object instance)
   at object Eto.Forms.ThemedControls.ThemedPropertyGrid.GetValue(PropertyItem propertyItem)
   at object Eto.Forms.ThemedControls.ThemedPropertyGrid+PropertyItem.get_Value()
   at object RuntimeMethodHandle.InvokeMethod(object target, Void** arguments, Signature sig, bool isConstructor)
   at object System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at object System.ComponentModel.ReflectPropertyDescriptor.GetValue(object component)
   at T Eto.Forms.PropertyBinding<T>.InternalGetValue(object dataItem)
   --- End of inner exception stack trace ---
   at T Eto.Forms.PropertyBinding<T>.InternalGetValue(object dataItem)
   at T Eto.Forms.IndirectBinding<T>.GetValue(object dataItem)
   at TValue Eto.Forms.ObjectBinding<T, TValue>.get_DataValue()
   at void Eto.Forms.DualBinding<T>.SetDestination()
   at void Eto.Forms.DualBinding<T>.HandleSourceChanged(object sender, EventArgs e)
   at void Eto.Forms.DirectBinding<T>.OnDataValueChanged(EventArgs e)
   at void Eto.Forms.ObjectBinding<T, TValue>.TriggerDataValueChanged()
   at DualBinding<TValue> Eto.Forms.BindableBinding<T, TValue>.BindDataContext(IndirectBinding<TValue> dataContextBinding, DualBindingMode mode, TValue defaultControlValue, TValue defaultContextValue)+(object sender, EventArgs e) => { }
   at void Eto.Forms.DirectBinding<T>.OnDataValueChanged(EventArgs e)
   at void Eto.Forms.ObjectBinding<T, TValue>.HandleChangedEvent(object sender, EventArgs e)
   at void Eto.PropertyStore.TriggerEvent<T>(object key, object sender, T args)
   at void Eto.Forms.BindableWidget.OnDataContextChanged(EventArgs e)
   at void Eto.Forms.BindableWidget.set_DataContext(object value)
   at void Eto.Forms.CustomCell.OnConfigureCell(CellEventArgs args, Control control)
   at void Eto.Forms.PropertyCell.OnConfigureCell(CellEventArgs args, Control control)
   at void Eto.Forms.CustomCell+Callback.OnConfigureCell(CustomCell widget, CellEventArgs args, Control control)
   at void Eto.Wpf.Forms.Cells.CustomCellHandler+Column.HandleControlDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
   at void System.Windows.FrameworkElement.OnDataContextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at void System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at void System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at UpdateResult System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, ref EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, OperationType operationType)
   at bool System.Windows.TreeWalkHelper.InvalidateTreeDependentProperty(TreeChangeInfo info, DependencyObject d, ref FrameworkObject fo, DependencyProperty dp, FrameworkPropertyMetadata fMetadata, Style selfStyle, Style selfThemeStyle, ref ChildRecord childRecord, bool isChildRecordValid, bool hasStyleChanged, bool isSelfInheritanceParent, bool wasSelfInheritanceParent)
   at FrugalObjectList<DependencyProperty> System.Windows.TreeWalkHelper.InvalidateTreeDependentProperties(TreeChangeInfo info, FrameworkElement fe, FrameworkContentElement fce, Style selfStyle, Style selfThemeStyle, ref ChildRecord childRecord, bool isChildRecordValid, bool hasStyleChanged, bool isSelfInheritanceParent, bool wasSelfInheritanceParent)
   at FrugalObjectList<DependencyProperty> System.Windows.FrameworkElement.InvalidateTreeDependentProperties(TreeChangeInfo parentTreeState, bool isSelfInheritanceParent, bool wasSelfInheritanceParent)
   at void System.Windows.FrameworkElement.OnAncestorChangedInternal(TreeChangeInfo parentTreeState)
   at void System.Windows.TreeWalkHelper.InvalidateOnTreeChange(FrameworkElement fe, FrameworkContentElement fce, DependencyObject parent, bool isAddOperation)
   at void System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
   at void System.Windows.FrameworkElement.AddLogicalChild(object child)
   at void System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at void System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at UpdateResult System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, ref EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, OperationType operationType)
   at void System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, object value, PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, OperationType operationType, bool isInternal)
   at void System.Windows.DependencyObject.SetValue(DependencyProperty dp, object value)
   at void System.Windows.Controls.DataGridCell.PrepareCell(object item, DataGridRow ownerRow, int index)
   at void System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, object item)
   at void System.Windows.Controls.DataGridCellsPanel.AddContainerFromGenerator(int childIndex, UIElement child, bool newlyRealized)
   at UIElement System.Windows.Controls.DataGridCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, DataGridColumn column, ref int childIndex, out Size childSize)
   at Size System.Windows.Controls.DataGridCellsPanel.GenerateChildren(IItemContainerGenerator generator, int startIndex, int endIndex, Size constraint)
   at Size System.Windows.Controls.DataGridCellsPanel.GenerateAndMeasureChildrenForRealizedColumns(Size constraint)
   at Size System.Windows.Controls.DataGridCellsPanel.MeasureOverride(Size constraint)
   at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at void System.Windows.UIElement.Measure(Size availableSize)
   at Size MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at void System.Windows.UIElement.Measure(Size availableSize)
   at Size System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at void System.Windows.UIElement.Measure(Size availableSize)
   at void System.Windows.Controls.Grid.MeasureCell(int cell, bool forceInfinityV)
   at void System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, Size referenceSize, bool ignoreDesiredSizeU, bool forceInfinityV, out bool hasDesiredSizeUChanged)
   at Size System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at void System.Windows.UIElement.Measure(Size availableSize)
   at Size System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at void System.Windows.UIElement.Measure(Size availableSize)
   at Size System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at void System.Windows.UIElement.Measure(Size availableSize)
   at void System.Windows.Controls.VirtualizingStackPanel.MeasureChild(ref IItemContainerGenerator generator, ref IContainItemStorage itemStorageProvider, ref IContainItemStorage parentItemStorageProvider, ref object parentItem, ref bool hasUniformOrAverageContainerSizeBeenSet, ref double computedUniformOrAverageContainerSize, ref double computedUniformOrAverageContainerPixelSize, ref bool computedAreContainersUniformlySized, ref bool hasAnyContainerSpanChanged, ref IList items, ref object item, ref IList children, ref int childIndex, ref bool visualOrderChanged, ref bool isHorizontal, ref Size childConstraint, ref Rect viewport, ref VirtualizationCacheLength cacheSize, ref VirtualizationCacheLengthUnit cacheUnit, ref long scrollGeneration, ref bool foundFirstItemInViewport, ref double firstItemInViewportOffset, ref Size stackPixelSize, ref Size stackPixelSizeInViewport, ref Size stackPixelSizeInCacheBeforeViewport, ref Size stackPixelSizeInCacheAfterViewport, ref Size stackLogicalSize, ref Size stackLogicalSizeInViewport, ref Size stackLogicalSizeInCacheBeforeViewport, ref Size stackLogicalSizeInCacheAfterViewport, ref bool mustDisableVirtualization, bool isBeforeFirstItem, bool isAfterFirstItem, bool isAfterLastItem, bool skipActualMeasure, bool skipGeneration, ref bool hasBringIntoViewContainerBeenMeasured, ref bool hasVirtualizingChildren)
   at Size System.Windows.Controls.VirtualizingStackPanel.MeasureOverrideImpl(Size constraint, ref double? lastPageSafeOffset, ref List<double> previouslyMeasuredOffsets, ref double? lastPagePixelSize, bool remeasure)
   at Size System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
   at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at void System.Windows.UIElement.Measure(Size availableSize)
   at void System.Windows.ContextLayoutManager.UpdateLayout()
   at object System.Windows.ContextLayoutManager.UpdateLayoutCallback(object arg)
   at void System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at void System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget)
   at object System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget)
   at object System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, object args, int numArgs)
   at object System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, Delegate callback, object args, int numArgs, Delegate catchHandler)
   at void System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at void MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)
   at void MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, object state)
   at void System.Windows.Threading.DispatcherOperation.Invoke()
   at void System.Windows.Threading.Dispatcher.ProcessQueue()
   at IntPtr System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
   at IntPtr MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
   at object MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)
   at object System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, object args, int numArgs)
   at object System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, Delegate callback, object args, int numArgs, Delegate catchHandler)
   at object System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, object args, int numArgs)
   at IntPtr MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam)
   at IntPtr MS.Win32.UnsafeNativeMethods.DispatchMessage(in MSG msg)
   at void System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at object System.Windows.Window.ShowHelper(object booleanBox)
   at void System.Windows.Window.Show()
   at bool? System.Windows.Window.ShowDialog()
   at void Eto.Wpf.Forms.DialogHandler.ShowModal()
   at void Eto.Forms.Dialog.ShowModal() x 2
   at T Eto.Forms.Dialog<T>.ShowModal(Control owner)
   at Control Eto.Forms.ThemedControls.ThemedPropertyGrid+PropertyCellTypeObject.OnCreate(CellEventArgs args)+(object sender, EventArgs e) => { }
   at void Eto.PropertyStore.TriggerEvent<T>(object key, object sender, T args)
   at void Eto.Forms.Button.OnClick(EventArgs e)
   at void Eto.Forms.Button+Callback.OnClick(Button widget, EventArgs e)
   at void Eto.Wpf.Forms.Controls.ButtonHandler<TControl, TWidget, TCallback>.Initialize()+(object sender, RoutedEventArgs e) => { }
   at void System.Windows.EventRoute.InvokeHandlersImpl(object source, RoutedEventArgs args, bool reRaised)
   at void System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at void System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at void System.Windows.Controls.Button.OnClick()
   at void System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at void System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, object target)
   at void System.Windows.EventRoute.InvokeHandlersImpl(object source, RoutedEventArgs args, bool reRaised)
   at void System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at void System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, object target)
   at void System.Windows.EventRoute.InvokeHandlersImpl(object source, RoutedEventArgs args, bool reRaised)
   at void System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at void System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at bool System.Windows.Input.InputManager.ProcessStagingArea()
   at bool System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at bool System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, int timestamp, RawMouseActions actions, int x, int y, int wheel)
   at IntPtr System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, ref bool handled)
   at IntPtr System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
   at IntPtr MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
   at object MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)
   at object System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, object args, int numArgs)
   at object System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, Delegate callback, object args, int numArgs, Delegate catchHandler)
   at object System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, object args, int numArgs)
   at IntPtr MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam)
   at IntPtr MS.Win32.UnsafeNativeMethods.DispatchMessage(in MSG msg)
   at void System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at object System.Windows.Application.RunDispatcher(object ignore)
   at int System.Windows.Application.RunInternal(Window window)
   at void Eto.Wpf.Forms.ApplicationHandler.Run()
   at void Eto.Forms.Application.Run(Form mainForm)
   at void PropGridDict.Wpf.Program.Main(string[] args) in D:/Git/Eto/PropGridDict/PropGridDict.Wpf/Program.cs:line 15

Code that Demonstrates the Problem

using System;
using System.Collections.Generic;
using Eto.Forms;

namespace PropGridDict.Wpf
{
    class Program
    {
        [STAThread]
        public static void Main(string[] args)
        {
            new Application(new Eto.Wpf.Platform()).Run(
                new Form
                {
                    Content = new PropertyGrid
                    {
                        SelectedObject = new
                        {
                            Dict = new Dictionary<string, string>()
                        }
                    }
                }
            );
        }
    }
}

Specifications

  • Version: 2.8.3
  • Platform(s): WPF
  • Operating System(s): Windows 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant