BindingExpressionBase.UpdateNotifyDataErrorValidationErrors throws NullReferenceException
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
Targeting `.NET 6`. This happened twice, but I have no reliable way to reproduce it.
```
PresentationFramework.dll!System.Windows.Data.BindingExpressionBase.UpdateNotifyDataErrorValidationErrors(System.Collections.Generic.List errors) Unknown
PresentationFramework.dll!System.Windows.Data.BindingExpression.UpdateNotifyDataErrors(System.ComponentModel.INotifyDataErrorInfo indei, string propertyName, object value) Unknown
PresentationFramework.dll!System.Windows.Data.BindingExpression.OnErrorsChanged.AnonymousMethod__108_0(object arg) Unknown
PresentationFramework.dll!MS.Internal.Data.DataBindEngine.ProcessCrossThreadRequests() Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj) Unknown
> System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 179 C#
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(nint hwnd, int msg, nint wParam, nint lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(nint hwnd, int msg, nint wParam, nint lParam, ref bool handled) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(nint hwnd, int msg, nint wParam, nint lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unknown
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Unknown
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unknown
```

### Reproduction Steps
No way to reproduce it. You will have to perform some static analysis...
### Expected behavior
We should not get a `NullReferenceException` for each item in the rendered items control.
### Actual behavior
A `NullReferenceException` is thrown for each item in our bound list.
### Regression?
_No response_
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
_No response_
### Other information
We are using [BindingOperations.EnableCollectionSynchronization()](https://learn.microsoft.com/en-us/dotnet/api/system.windows.data.bindingoperations.enablecollectionsynchronization?view=windowsdesktop-9.0) on our custom `ObservableCollection`, if that matters. (This code has been in production for several years, and we never encountere this prior to `.NET Core` migration.)
Contributor guide
Assessment
This issue has not been assessed yet.