diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlException.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlException.cs index 5f4e952ec8..2c50c5a3d7 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlException.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlException.cs @@ -14,7 +14,6 @@ namespace Microsoft.Data.SqlClient { /// [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed partial class SqlException : System.Data.Common.DbException { private const string OriginalClientConnectionIdKey = "OriginalClientConnectionId"; @@ -214,7 +213,7 @@ internal static SqlException CreateException(SqlErrorCollection errorCollection, } exception.Data.Add("HelpLink.EvtSrc", "MSSQLServer"); exception.Data.Add("HelpLink.EvtID", errorCollection[0].Number.ToString(CultureInfo.InvariantCulture)); - exception.Data.Add("HelpLink.BaseHelpUrl", "http://go.microsoft.com/fwlink"); + exception.Data.Add("HelpLink.BaseHelpUrl", "https://go.microsoft.com/fwlink"); exception.Data.Add("HelpLink.LinkId", "20476"); return exception; diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs index ebbc95873c..97cd1909ab 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; using Newtonsoft.Json; using Xunit; @@ -31,6 +33,28 @@ public void SerializationTest() Assert.Equal(e.StackTrace, sqlEx.StackTrace); } + + [Fact] + [ActiveIssue("12161", TestPlatforms.AnyUnix)] + public static void SqlExcpetionSerializationTest() + { + var formatter = new BinaryFormatter(); + SqlException e = CreateException(); + using (var stream = new MemoryStream()) + { + try + { + formatter.Serialize(stream, e); + stream.Position = 0; + var e2 = (SqlException)formatter.Deserialize(stream); + } + catch (Exception ex) + { + Assert.False(true, $"Unexpected Exception occurred: {ex.Message}"); + } + } + } + [Fact] public void JSONSerializationTest() {