From 5bc145c4757d34ef9555bb7067e7e0c19edca5e8 Mon Sep 17 00:00:00 2001 From: Carol Wang Date: Fri, 8 May 2020 19:45:19 -0700 Subject: [PATCH] Add FaultException ctor with String as param --- .../ref/System.ServiceModel.Primitives.cs | 1 + .../tests/ServiceModel/FaultExceptionTest.cs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs b/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs index c44a0ae27c5..0c0d078a018 100644 --- a/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs +++ b/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs @@ -503,6 +503,7 @@ public FaultContractAttribute(System.Type detailType) { } public partial class FaultException : System.ServiceModel.CommunicationException { public FaultException() { } + public FaultException(string reason) { } public FaultException(System.ServiceModel.Channels.MessageFault fault, string action) { } public FaultException(System.ServiceModel.FaultReason reason, System.ServiceModel.FaultCode code, string action) { } protected FaultException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } diff --git a/src/System.ServiceModel.Primitives/tests/ServiceModel/FaultExceptionTest.cs b/src/System.ServiceModel.Primitives/tests/ServiceModel/FaultExceptionTest.cs index 63e78b88e37..98651226d38 100644 --- a/src/System.ServiceModel.Primitives/tests/ServiceModel/FaultExceptionTest.cs +++ b/src/System.ServiceModel.Primitives/tests/ServiceModel/FaultExceptionTest.cs @@ -47,4 +47,15 @@ public static void Serializable_Default() Assert.Equal(netfxBsl, sr.ReadToEnd()); } } + + [WcfFact] + public static void Ctor_StringReason() + { + string reason = "Fault reason"; + var exception = new FaultException(reason); + Assert.NotNull(exception); + Assert.NotNull(exception.Reason); + Assert.NotNull(exception.Code); + Assert.Equal(reason, exception.Reason.ToString()); + } }