Setup Problems

Crash when opening config on VS2022 Preview 4.1

Started by rgwood on 3,795 views

NCrunch version: 4.9.0.8
VS version: 2022 Preview 4.1

Steps to reproduce:

1. Open VS (either a solution or without code), wait for NCrunch icon in bottom right to load
2. Press Alt-U to open NCrunch menu, select Configuration

After that, VS hangs for a bit then crashes. There is an Error event from the source ".NET Runtime" in the Application event log:
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ComponentModel.Win32Exception
at MS.Win32.UnsafeNativeMethods.GetWindowText(System.Runtime.InteropServices.HandleRef, System.Text.StringBuilder, Int32)
at System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()
at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
at System.Windows.ContextLayoutManager.fireAutomationEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(System.Windows.Media.Visual)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double, Double, Double, Double)
at System.Windows.Window.CreateSourceWindow(Boolean)
at System.Windows.Window.ShowHelper(System.Object)
at Microsoft.VisualStudio.PlatformUI.Shell.Controls.CustomChromeWindow.DwmOwnsBorderChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
at System.Windows.DependencyObject.SetValue(System.Windows.DependencyPropertyKey, System.Object)
at Microsoft.VisualStudio.PlatformUI.Shell.Controls.CustomChromeWindow.UpdateGlowBorder(Boolean, Boolean)
at Microsoft.VisualStudio.PlatformUI.Shell.Controls.CustomChromeWindow.WmNcCalcSize(IntPtr, IntPtr, IntPtr, Boolean ByRef)
at Microsoft.VisualStudio.PlatformUI.Shell.Controls.FloatingWindow.HwndSourceHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

Fixes attempted unsuccessfully:
1. Delete contents of %USERPROFILE%\AppData\Roaming\NCrunch
2. Uninstall/reinstall NCrunch
Thanks for sharing this issue.

At first glance this looks to me to be an internal VS problem which is probably being triggered by the NCrunch tool window. We're looking into it to see if there's anything that can be done about it from our side. Could you try removing any .user files for the relevant solution to see if resetting the tool window layout resolves it?
Thanks for the quick reply. Same result after deleting .user files and restarting VS.
rgwood wrote:Thanks for the quick reply. Same result after deleting .user files and restarting VS.



Thanks, we're trying to reproduce this.

Can you confirm if any of the other NCrunch tool windows work for you? (i.e. Tests Window, Processing Queue, etc).
Tests Window: crash
Processing Queue: crash
Distributed Processing: crash
Submit Bug Report: opens correctly
LicenseDetails and About: opens window, window closes immediately thereafter (in much less than a second), does not crash
We've conducted some in-depth testing around known scenarios here involving differences in VS install state and have been unable to reproduce this issue.

The following issue reports are extremely interesting:
https://github.com/dotnet/wpf/issues/4181
https://developercommunity.visualstudio.com/t/random-exceptions-in-windowautomationpeergetnameco/998916

Right now, it looks to me like there are two likely causes here:
1. Something external has implemented an O/S level hook that causes VS to crash when executing this code path. Because NCrunch triggers the code path due to its tool window, NCrunch indirectly triggers the crash.
2. There is a bug in VS which is surfaced by something in your install state, which causes it to crash when attempting to open tool windows created by packages.

In either case, there is nothing we can do on the side of NCrunch to resolve this problem. Presently we cannot reproduce it, which makes it impossible for us to engineer any kind of workaround, and as we don't have any code running in the affected code path, we can't implement a speculative fix.

I recommend removing any third party software you have installed that may implement WPF hooks (NCrunch doesn't do this). You might need to remove and reinstall VS.
Thanks for the testing+investigation.

I've tried stopping software that seems like it might be using hooks (PowerToys, Power Automate, 1Password, SnagIt), no luck. Also tried disabling other VS extensions without any luck. I'll try reinstalling VS when I have time.
Still crashing after a VS reinstall. Will keep trying to figure out what might be installing a hook.
I've reinstalled Windows (to rule out any malware that might be installing that hook) but this issue is still occurring; seems like VS is the only remaining suspect.

I've filed an issue on Developer Community with crash logs etc.: https://developercommunity.visualstudio.com/t/Crash-when-using-NCrunch-on-VS-2022-Prev/1544656
FYI this issue seems to have gone away after upgrading to Windows 11 (from whatever the latest stable version of Windows 10 before that was). Thanks again for looking into it.

Post a reply

Log in to reply.