Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -9,4 +9,7 @@ partial class SR
public const string SynchronizedCollectionWrongType1 = "A value of type '{0}' cannot be added to the generic collection, because the collection has been parameterized with a different type.";
public const string SynchronizedCollectionWrongTypeNull = "A null value cannot be added to the generic collection, because the collection has been parameterized with a value type.";
public const string ValueMustBeInRange = "The value of this argument must fall within the range {0} to {1}.";
public const string XmlLangAttributeMissing = "Required xml:lang attribute value is missing.";
public const string InvalidXmlQualifiedName = "Expected XML qualified name, found '{0}'";
public const string UnboundPrefixInQName = "Unbound prefix used in qualified name '{0}'.";
}

View File

@@ -40,8 +40,9 @@ namespace System.ServiceModel.Channels
public static MessageFault CreateFault (Message message, int maxBufferSize)
{
try {
if (message.Version.Envelope == EnvelopeVersion.Soap11)
return CreateFault11 (message, maxBufferSize);
if (message.Version.Envelope == EnvelopeVersion.Soap11) {
return CreateFault11 (message, maxBufferSize);
}
else // common to None and SOAP12
return CreateFault12 (message, maxBufferSize);
} catch (XmlException ex) {
@@ -55,14 +56,14 @@ namespace System.ServiceModel.Channels
FaultReason fr = null;
string actor = null;
XmlDictionaryReader r = message.GetReaderAtBodyContents ();
r.ReadStartElement ("Fault", message.Version.Envelope.Namespace);
fc = ReadFaultCode11 (r, maxBufferSize);
r.MoveToContent ();
while (r.NodeType != XmlNodeType.EndElement) {
switch (r.LocalName) {
case "faultcode":
fc = ReadFaultCode11 (r);
break;
switch (r.LocalName) {
case "faultstring":
fr = new FaultReason (r.ReadElementContentAsString());
break;
@@ -128,26 +129,27 @@ namespace System.ServiceModel.Channels
return new SimpleMessageFault (fc, fr, false, null, null, null, node);
}
static FaultCode ReadFaultCode11 (XmlDictionaryReader r)
// In reference source for soap 1.1, the fault code value is not strictly enforced as per the
// Namespaces in XML spec.
//
// Additionally, the fault sub code is not looked for:
//
// See: https://referencesource.microsoft.com/#System.ServiceModel/System/ServiceModel/Channels/MessageFault.cs,f23a5298fd999b2d
//
static FaultCode ReadFaultCode11 (XmlDictionaryReader reader, int maxBufferSize)
{
FaultCode subcode = null;
XmlQualifiedName value = XmlQualifiedName.Empty;
FaultCode code;
string ns;
string name;
if (r.IsEmptyElement)
throw new ArgumentException ("Fault Code is mandatory in SOAP fault message.");
reader.ReadStartElement ("faultcode", "");
XmlUtil.ReadContentAsQName (reader, out name, out ns);
code = new FaultCode (name, ns);
r.ReadStartElement ("faultcode");
r.MoveToContent ();
while (r.NodeType != XmlNodeType.EndElement) {
if (r.NodeType == XmlNodeType.Element)
subcode = ReadFaultCode11 (r);
else
value = (XmlQualifiedName) r.ReadContentAs (typeof (XmlQualifiedName), r as IXmlNamespaceResolver);
r.MoveToContent ();
}
r.ReadEndElement ();
return new FaultCode (value.Name, value.Namespace, subcode);
reader.ReadEndElement ();
return code;
}
static FaultCode ReadFaultCode12 (XmlDictionaryReader r, string ns)

View File

@@ -912,4 +912,5 @@ System.ServiceModel.Configuration/HttpBindingBaseElement.cs
System.ServiceModel.Configuration/BasicHttpsBindingElement.cs
System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs
System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs
../referencesource/System.ServiceModel/System/ServiceModel/XmlUtil.cs

View File

@@ -0,0 +1,8 @@
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>s:1</faultcode>
<faultstring xml:lang="en-US">String is empty.</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>

View File

@@ -22,6 +22,15 @@ namespace MonoTests.System.ServiceModel.Channels
MessageFault.CreateFault (msg, 0x10000);
}
[Test]
public void CreateFaultWithNumberCode ()
{
var msgVersion = MessageVersion.CreateVersion (EnvelopeVersion.Soap11, AddressingVersion.None);
var msg = Message.CreateMessage (XmlReader.Create (new StreamReader (TestResourceHelper.GetFullPathOfResource ("Test/Resources/soap-fault-number.xml"))), 0x10000, msgVersion);
MessageFault.CreateFault (msg, 0x10000);
}
[Test]
public void CreateFaultMessageVersionNone ()
{

View File

@@ -296,3 +296,4 @@ System.ServiceModel.Security.Tokens/SecurityTokenReferenceStyle.cs
System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParameters.cs
System.ServiceModel.Security.Tokens/SupportingTokenParameters.cs
System.ServiceModel.Security.Tokens/UserNameSecurityTokenParameters.cs
../referencesource/System.ServiceModel/System/ServiceModel/XmlUtil.cs