-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MS.Internal.Invariant.get_IsDialogOverrideEnabled() can throw NullReferenceException #6772
Comments
@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? |
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. |
I can sure the win7 (since 2013) has created the |
…hen .NET Framework Registry key (HKLM\Software\Microsoft\.NETFramework) is not present on the machine dotnet#6772
I have created a PR: #6785 |
…6785) * Fix NullReferenceException in Invariant.get_IsDialogOverrideEnabled when .NET Framework Registry key (HKLM\Software\Microsoft\.NETFramework) is not present on the machine #6772 * Update src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Invariant.cs Co-authored-by: Dipesh Kumar <[email protected]> * Remove unnecessary declarations Co-authored-by: Dipesh Kumar <[email protected]>
…6785) * Fix NullReferenceException in Invariant.get_IsDialogOverrideEnabled when .NET Framework Registry key (HKLM\Software\Microsoft\.NETFramework) is not present on the machine #6772 * Update src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Invariant.cs Co-authored-by: Dipesh Kumar <[email protected]> * Remove unnecessary declarations Co-authored-by: Dipesh Kumar <[email protected]>
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)
The text was updated successfully, but these errors were encountered: