When I un-dock a tab in SQL Server Management Studio and later attempt to re-dock it, SSMS crashes. This happens every time, and I can reproduce the problem at will. All I have to do is un-dock a tab (let's say, in order to view two SQL queries in different tabs side-by-side) and then attempt to re-dock it, and SSMS will crash. Looking at the Event Viewer, I find two successive error messages each time the crash happens, the first with its Source set to ".NET Runtime" and the second with its source set to "Application Error" in the Event Viewer:
Application: Ssms.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException at System.Windows.Interop.HwndMouseInputProvider.HasCustomChrome(System.Windows.Interop.HwndSource, RECT ByRef) at System.Windows.Interop.HwndMouseInputProvider.GetEffectiveClientRect(IntPtr) at System.Windows.Interop.HwndMouseInputProvider.PossiblyDeactivate(IntPtr, Boolean) at System.Windows.Interop.HwndMouseInputProvider.Dispose() at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef) at System.Windows.Interop.HwndSource.InputFilterMessage(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)
Faulting application name: Ssms.exe, version: 2019.150.18369.0, time stamp: 0x5fd317a3 Faulting module name: PresentationCore.ni.dll, version: 4.8.4320.0, time stamp: 0x5fc81198 Exception code: 0xc0000005 Fault offset: 0x0076c044 Faulting process id: 0x166c Faulting application start time: 0x01d6fc1a384c50f7 Faulting application path: C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe Faulting module path: C:\Windows\assembly\NativeImages_v4.0.30319_32\PresentationCore\627e2c47709994c2c1f8fd2e1228d567\PresentationCore.ni.dll Report Id: 1b2fa46b-b60c-4517-bd91-1d4de7324b26 Faulting package full name: Faulting package-relative application ID:
Has anyone else experienced this issue and found a fix or a workaround for it?
The "fix" turned out to be this:
First, close all SSMS windows. Next, find your SSMS executable file. Mine was in this location:
C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE
(If you can't find it, try right-clicking on the shortcut you use to open SSMS and going to Properties --> Open File Location)
Once you have found this file, you will also find a file called Ssms.exe.config in the same folder - open Notepad in Administrator Mode and edit this Ssms.exe.config file.
In the Ssms.exe.config file, find an XML tag called
<AppContextSwitchOverrides>, and APPEND (not replace) the following exactly:
Then, save the file with the change you just made.
After making this change, SSMS should no longer crash or hang when you manually re-dock windows into the tab bar.
Try add this line to the
<runtime>-section in the *****.exe.config-File which do you start.
<AppContextSwitchOverrides value="Switch.System.Windows.Interop.MouseInput.OptOutOfMoveToChromedWindowFix=true; Switch.System.Windows.Interop.MouseInput.DoNotOptOutOfMoveToChromedWindowFix=true" />
I had the same problem with Visual Studio and it helps: Visual Studio 2015 Isolated Shell application crashing when docking Tool window after update to MS KB4601050
Here is is the Microsoft-Statement: https://support.microsoft.com/de-de/topic/kumulatives-update-vom-9-februar-2021-f%C3%BCr-net-framework-3-5-und-4-8-f%C3%BCr-windows-10-version-1809-und-windows-server-version-2019-kb4601055-38aea913-ccd7-bc76-db60-9521318f97cb
This was fixed in SSMS 18.9, released on April 15, 2021. Fiddling with the config file is no longer required.
General SSMS Fixed a crash (in the Visual Studio Shell) that was causing SSMS to crash when re-docking tabs. See SQL Server user feedback
User contributions licensed under CC BY-SA 3.0