question

Zoomy-7958 avatar image
43 Votes"
Zoomy-7958 asked HongShen-2154 published

SSMS 18.8 crashes when re-docking tabs

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 (see the pasted messages below).

Please fix this! It's wreaking havoc on my usual workflow. Thanks.

Message #1:

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)

Message #2:

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:

sql-server-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

VinnieAmir-0621 avatar image
57 Votes"
VinnieAmir-0621 answered HongShen-2154 published

Fix:

  1. Close all SSMS windows, and find your SQL Mgt Studio EXE file, mine was in:

C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE

If you cant find it, right click your shortcut you use to open SSMS and go Properties > Open File Location

  1. Once you have found this, you will also find a file called "Ssms.exe.config, open up a Notepad in Administrator Mode, and edit this file

  2. You will then need to find an xml tag called <AppContextSwitchOverrides>, and APPEND (not replace) the following exactly:

;Switch.System.Windows.Interop.MouseInput.OptOutOfMoveToChromedWindowFix=true; Switch.System.Windows.Interop.MouseInput.DoNotOptOutOfMoveToChromedWindowFix=true

  1. And that is it. You will now avoid this nasty crash

https://support.microsoft.com/en-us/topic/february-9-2021-kb4601060-cumulative-update-for-net-framework-3-5-and-4-7-2-for-windows-10-version-1809-and-windows-server-version-2019-b240d07e-639f-d708-98c9-0cbe443176aa



· 17
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks It worked. I changed the following file.
C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe
with the following xml tag between the <runtime>.
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Interop.MouseInput.OptOutOfMoveToChromedWindowFix=true; Switch.System.Windows.Interop.MouseInput.DoNotOptOutOfMoveToChromedWindowFix=true" />
</runtime>

6 Votes 6 ·

thanks for this. my .config file did not even have this element, so i wasn't even sure where it should go. thank you!

1 Vote 1 ·

Saved my day. Thanks.

0 Votes 0 ·

Thanks a lot for posting these detailed instructions! But you should convert this to an answer, so that Zoomy can accept it, if he likes.

4 Votes 4 ·

Hi @VinnieAmir-0621, thanks a lot for the detailed instructions. I followed your instructions exactly and then retested, and the issue seems to be fixed. I was hesitant to try some of the other answers because they didn't specifically target SSMS even though they were apparently on the right general track. As @ErlandSommarskog said, if you would please convert this to an answer then I will accept it. Thank you very much for taking the time to reply.

2 Votes 2 ·

Done, sorry, first time using this site, I did this in a rush. It is done, and I am glad I can save other the frustration.

3 Votes 3 ·

Thanks for this! I know VS2019 Professional was having this issue too, but they already patched it. I was surprised this hasn't been patched yet!

1 Vote 1 ·

Thank you so much! This prevents a lot of annoyance :-)

1 Vote 1 ·
Show more comments
ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered Zoomy-7958 commented

I was able to repeat that. On the first attempt.

You can report bugs on https://feedback.azure.com/forums/908035-sql-server.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for confirming. I also reported the issue on feedback.azure.com, but have not received a response yet.


0 Votes 0 ·
Cathyji-msft avatar image
0 Votes"
Cathyji-msft answered RyanRisley-0980 published

Hi @Zoomy-7958,

It works well in my environment, I am using SSMS 18.8. On the menu bar, select Window, then Reset Window Layout. This will place object explorer to its original position.

Or right click on object explorer, now you can see an option called "Dock", select "Dock". By this object explorer comes to normal position as earlier.

For SQL query windows tab, it also works well in my environment, I can move them back as earlier.

Did you try to use SSMS 17.9.1 or SSMS 18.7.1? you can get them from here.

If I misunderstood your issue, please let me know.


If the response is helpful, please click "Accept Answer", thank you.



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I think you may have misunderstood the issue. In a tabbed window layout, simply try manually clicking-and-dragging one of the docked (its default) tabs away from the main SSMS window (i.e. undocking it). Then release your mouse button, wait a second, then click-and-drag the newly-undocked tab back into the main tab bar (i.e. re-dock it). This is the point at which SSMS routinely crashes for me.

1 Vote 1 ·

Yes!

I cannot be admin, then cannot use the solution.
I tried to find the button in Windows tab, but di not find. Thn I customize the menu, I found in french "rétablir la disposition de fenêtre" and click on it, restored the original layout with the object explorer.

very annoying crash, when yo undock the object explorer and want to redock it.

0 Votes 0 ·

17.9.1 has the same issue.

0 Votes 0 ·
VladyslavQA-0057 avatar image
0 Votes"
VladyslavQA-0057 answered

I got the same problem, reinstall VS reset the settings, log out of the account, nothing helps. Cannot move tabs, test window tab cannot be docked to program window

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JustinG-9341 avatar image
0 Votes"
JustinG-9341 answered

Hi @Zoomy-7958 , this is also started suddenly happening to me in VS2017, which lead me to believe a windows update was to blame rather than the software itself.

Please see: https://developercommunity.visualstudio.com/content/problem/1323017/unexpected-vs-crash-when-docking-or-splitting-wind.html

MS has identified KB4598301 as the root cause and offers some work arounds for VS, which may also apply to SMSS.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ErlandSommarskog avatar image
1 Vote"
ErlandSommarskog answered ErlandSommarskog commented

I got a tip from an MVP colleague that a KB update could be a problem just like Justin suggests. It appears that there are two of them, KB4598299 and KB4598301. I have KB4598299 on two machines, and I see the crash on both. I also get the same crash in Visual Studio 2017 - quite expected, since SSMS uses the VS2017 shell.

I uninstalled KB4598299 on of the machines, and after the uninstall, I don't get the crash, so that appears to be the solution.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KG4598299 is a preview. Today is patch Tuesday and the "real thing" is available, KB4601050. This update has the same issue. Don't install it if you like to undock and re-dock tabs. (I don't do this myself very often, but I see the point.)

0 Votes 0 ·
Zoomy-7958 avatar image
0 Votes"
Zoomy-7958 answered VladyslavQA-0057 edited

Thanks for the answers. I suspected it might be the result of a recent Windows Update, as you've suggested. Unfortunately, I don't see any of the exact KB* updates you mention on my machine. I'm running Windows Server 2019 Standard, Version 10.0.17763 Build 17763, if that helps. Are the update numbers different for Windows Server? Regardless, I did another update just now hoping that a patch might have made it into the latest package of updates, but to no avail - SSMS still crashes when I manually un-dock and then attempt to re-dock a tab.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Try to make the changes indicated in this thread, my problem was solved

https://developercommunity.visualstudio.com/content/problem/1323017/unexpected-vs-crash-when-docking-or-splitting-wind.html

Find the file "devenv.exe.config" and add the value - ";Switch.System.Windows.Interop.MouseInput.OptOutOfMoveToChromedWindowFix=true;Switch.System.Windows.Interop.MouseInput.DoNotOptOutOfMoveToChromedWindowFix=true"

0 Votes 0 ·
ErlandSommarskog avatar image
1 Vote"
ErlandSommarskog answered

I don't know for sure, but I assume that there are different KBs for server OSs.

In any case, it is the .NET update for 2021-02 you want to get rid of. The final one came yesterday, and then there was a preview last week.

I had a little trouble finding these myself, but they are hiding under Other Updates in the View Update History.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Zoomy-7958 avatar image
0 Votes"
Zoomy-7958 answered ErlandSommarskog commented

Thanks also to @ErlandSommarskog and @VladyslavQA-0057 for their replies. It's quite possible that your suggestions would've also fixed the issue, now that I've had a chance to read the entire thread. Your help is greatly appreciated.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I think Vinnie's solution is the best one. Uninstalling the KB means that you probably lose on some other fixes. Plus I suspect that Windows would nag us about this update again and again.

1 Vote 1 ·
ElnieGabato-1044 avatar image
0 Votes"
ElnieGabato-1044 answered JD-8057 published

thanks it fixes wwooh! I'm alive again

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Fixed the issue for me too. Many thanks.

0 Votes 0 ·