Mam datagram danych wpf związany z atrybutem TrackableCollection. W rzadkich przypadkach i tylko dla kilku wybranych użytkowników aplikacja ulegnie awarii, gdy użytkownik doda nowy rekord, wprowadzając dolny pusty wiersz. Nie udało się odtworzyć problemu, a wszystko, co mam, to stos wyjątku. Czy ktoś widział coś takiego? Mam ograniczoną wiedzę na temat klas automatyzacji, ale mogę potwierdzić, że nie używamy żadnego z nich w naszej aplikacji.WPG DataGrid, awaria aplikacji podczas dodawania wiersza
Oto StackTrace:
System.ArgumentNullException: Value cannot be null.
Parameter name: item
at System.Windows.Automation.Peers.DataGridAutomationPeer.CreateItemAutomationPeer(Object item)
at System.Windows.Automation.Peers.ItemsControlAutomationPeer.FindOrCreateItemAutomationPeer(Object item)
at System.Windows.Automation.Peers.DataGridAutomationPeer.RaiseAutomationSelectionEvents(SelectionChangedEventArgs e)
at System.Windows.Controls.DataGrid.OnSelectionChanged(SelectionChangedEventArgs e)
at System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
at System.Windows.Controls.DataGrid.MakeFullRowSelection(Object dataItem, Boolean allowsExtendSelect, Boolean allowsMinimalSelect)
at System.Windows.Controls.DataGrid.HandleSelectionForCellInput(DataGridCell cell, Boolean startDragging, Boolean allowsExtendSelect, Boolean allowsMinimalSelect)
at System.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDown(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
XAML:
<DataGrid Name="OrdreSLinjeGrid"
AutoGenerateColumns="False"
CanUserResizeRows="False"
CanUserAddRows="{Binding KanLeggeTilOrdreLinjer}"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Visible"
ItemsSource="{Binding Order.OrderLines, Mode=TwoWay}" CanUserSortColumns="False"
SelectedItem="{Binding ValgtOrdreLinje}" >
<DataGrid.Columns>
<DataGridTextColumn
Header="{t:Translate Antall}"
TextAlignment="Right"
Width="50"
HeaderStyle="{StaticResource HøyrejustertColumnHeader}"
Binding="{Binding Antall, UpdateSourceTrigger=LostFocus}" />
<DataGridTextColumn
Header="{t:Translate Pris}"
Width="60"
HeaderStyle="{StaticResource HøyrejustertColumnHeader}"
Binding="{Binding Pris, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"
/>
</DataGrid.Columns>
</DataGrid>
Każde wejście lub sugestie będą mile widziane.
Czy możesz również umieścić kod wokół tej logiki, w której występuje ten wyjątek? – ryadavilli
Czy sieć jest przypisana do konkretnej nieruchomości? Jak wygląda twój Xaml? Co oznacza właściwość powiązana z xaml? –
@ryadavilli Wyjątek nie występuje w naszym kodzie. To coś wewnętrznie w WPG DataGrid. –