From 03c8a9c62197be1f61e76ecdc8572b0e6b3cdad1 Mon Sep 17 00:00:00 2001 From: Dileep <11182796+dileepsam@users.noreply.github.com> Date: Sun, 24 Nov 2024 20:06:24 +1000 Subject: [PATCH] fixes a issue when connection string ending with a ; causes an exception --- src/Common/Helpers/ServiceBusNamespace.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Common/Helpers/ServiceBusNamespace.cs b/src/Common/Helpers/ServiceBusNamespace.cs index c560a699..8b35aa5c 100644 --- a/src/Common/Helpers/ServiceBusNamespace.cs +++ b/src/Common/Helpers/ServiceBusNamespace.cs @@ -231,7 +231,8 @@ public static ServiceBusNamespace GetServiceBusNamespace(string key, string conn var isUserCreated = !(key == "CustomConnectionString" || key == "SASConnectionString"); var toLower = connectionString.ToLower(); - var parameters = connectionString.Split(';').ToDictionary(s => s.Substring(0, s.IndexOf('=')).ToLower(), s => s.Substring(s.IndexOf('=') + 1)); + var parameters = connectionString.Split([';'], StringSplitOptions.RemoveEmptyEntries) + .ToDictionary(s => s.Substring(0, s.IndexOf('=')).ToLower(), s => s.Substring(s.IndexOf('=') + 1)); if (toLower.Contains(ConnectionStringEndpoint) && toLower.Contains(ConnectionStringSharedAccessKeyName) &&