Repository navigation
Description
- .NET Core Version: 6.0
I have only the exception stack trace collected automatically from one of my clients. No other system information is available.
I hope that this stack trace would be useful for some research.
According to sources, IsDialogOverrideEnabled could throw NRE if registry key "Software\Microsoft\.NETFramework" is missing on the machine.
System.NullReferenceException: Object reference not set to an instance of an object. at bool MS.Internal.Invariant.get_IsDialogOverrideEnabled() at void MS.Internal.Invariant.Assert(bool condition) at IFontFamily System.Windows.Media.FontFamily.get_FirstFontFamily() at double System.Windows.Media.FontFamily.get_LineSpacing() at double System.Windows.Controls.TextBox.GetLineHeight() at void System.Windows.Controls.TextBox.SetScrollViewerMinMaxHeight() at Size System.Windows.Controls.TextBox.MeasureOverride(Size constraint) at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize) at void System.Windows.UIElement.Measure(Size availableSize) at Size System.Windows.Controls.DockPanel.MeasureOverride(Size constraint) at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize) at void System.Windows.UIElement.Measure(Size availableSize) at Size System.Windows.Controls.DockPanel.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.Controls.ContentPresenter.MeasureOverride(Size constraint) at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize) at void System.Windows.UIElement.Measure(Size availableSize) at Size Microsoft.Windows.Themes.ClassicBorderDecorator.MeasureOverride(Size availableSize) at Size System.Windows.FrameworkElement.MeasureCore(Size availableSize) at void System.Windows.UIElement.Measure(Size availableSize) 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 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.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.Grid.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.Controls.ContentPresenter.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 Size MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at Size System.Windows.Controls.ContentPresenter.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)
Activity
singhashish-wpf commentedon Jul 11, 2022
@VladimirKhil While it is true that there could be NRE if the Registry key isn't present, and the remediation could be as simple as a null check, Will it be possible for to update the issue with a minimal repro and would you be interested in submitting a PR?
VladimirKhil commentedon Jul 11, 2022
Unfortunately I do not know how to reproduce this issue in real environment. The only way that I can suggest is to create a Unit test with mocked Registry which could cause the error.
Yes, I can try to submit a PR.
lindexi commentedon Jul 12, 2022
I can sure the win7 (since 2013) has created the
Software\Microsoft\.NETFrameworkregister key. We can ignore this error in .NET Framework, because if the system has this error, it will not be able to start the application. But now that we use .NET Core, I will no longer require .NET Framework to be installed correctly on the system.Fix NullReferenceException in Invariant.get_IsDialogOverrideEnabled w…
VladimirKhil commentedon Jul 12, 2022
I have created a PR: #6785
Fix NullReferenceException in Invariant.get_IsDialogOverrideEnabled (#…
Fix NullReferenceException in Invariant.get_IsDialogOverrideEnabled (#…