From 2f8d5e5c2c1469e141e67c1dd49c41b4f3b9d609 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Thu, 7 Nov 2024 20:43:09 +0100 Subject: [PATCH] Fix SSMS crash due to MDS 3.1 in SSMS 20 --- src/GUI/SSMSToolbox/SSMSEngine/DatabaseMenuItem.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GUI/SSMSToolbox/SSMSEngine/DatabaseMenuItem.cs b/src/GUI/SSMSToolbox/SSMSEngine/DatabaseMenuItem.cs index 62fbf141..7e97b08c 100644 --- a/src/GUI/SSMSToolbox/SSMSEngine/DatabaseMenuItem.cs +++ b/src/GUI/SSMSToolbox/SSMSEngine/DatabaseMenuItem.cs @@ -119,7 +119,11 @@ private MenuItem BuildMenuItemForCommandHandler() var parent = Parent; if (parent?.Connection == null) return null; - var builder = new SqlConnectionStringBuilder(parent.Connection.ConnectionString); + var connectionString = parent.Connection.ConnectionString; + + connectionString = ReplaceMdsKeywords(connectionString); + + var builder = new SqlConnectionStringBuilder(connectionString); builder.InitialCatalog = parent.InvariantName; var dbInfo = new DatabaseInfo @@ -175,5 +179,12 @@ private ToolStripMenuItem BuildScriptMenuItem(System.Drawing.Bitmap scriptImage) scriptItem.DropDownItems.Add(scriptItem5); return scriptItem; } + + private string ReplaceMdsKeywords(string connectionString) + { + connectionString = connectionString.Replace("Multiple Active Result Sets=", "MultipleActiveResultSets="); + connectionString = connectionString.Replace("Trust Server Certificate=", "TrustServerCertificate="); + return connectionString; + } } }