From ade228f2f2fcc25a83b575cc0f45e7bff964ce58 Mon Sep 17 00:00:00 2001 From: Johnny Pham Date: Fri, 5 Nov 2021 16:29:47 -0700 Subject: [PATCH] Update SqlDependencyListener.cs --- .../Data/SqlClient/SqlDependencyListener.cs | 48 +++++++------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyListener.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyListener.cs index 5867bc3327..ce266f7fb9 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyListener.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyListener.cs @@ -1131,37 +1131,25 @@ internal static SqlNotification ProcessMessage(SqlXml xmlMessage) messageAttributes |= MessageAttributes.Source; break; case InfoAttribute: - try - { - string value = xmlReader.Value; - // 3 of the server info values do not match client values - map. - switch (value) - { - case "set options": - info = SqlNotificationInfo.Options; - break; - case "previous invalid": - info = SqlNotificationInfo.PreviousFire; - break; - case "query template limit": - info = SqlNotificationInfo.TemplateLimit; - break; - default: - SqlNotificationInfo temp = (SqlNotificationInfo)Enum.Parse(typeof(SqlNotificationInfo), value, true); - if (Enum.IsDefined(typeof(SqlNotificationInfo), temp)) - { - info = temp; - } - break; - } - } - catch (Exception e) + string value = xmlReader.Value; + // 3 of the server info values do not match client values - map. + switch (value) { - if (!ADP.IsCatchableExceptionType(e)) - { - throw; - } - ADP.TraceExceptionWithoutRethrow(e); // Discard failure, if it should occur. + case "set options": + info = SqlNotificationInfo.Options; + break; + case "previous invalid": + info = SqlNotificationInfo.PreviousFire; + break; + case "query template limit": + info = SqlNotificationInfo.TemplateLimit; + break; + default: + if (Enum.TryParse(value, true, out SqlNotificationInfo temp) && Enum.IsDefined(typeof(SqlNotificationInfo), temp)) + { + info = temp; + } + break; } messageAttributes |= MessageAttributes.Info; break;