Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@@ -8,6 +8,7 @@ namespace System.ServiceModel.Channels
using System.IO;
using System.Net.Http;
using System.Runtime;
using System.Threading.Tasks;
using System.Xml;
public static class ByteStreamMessage
@@ -552,6 +553,13 @@ namespace System.ServiceModel.Channels
static bool HandleWriteBodyContents(IAsyncResult result)
{
// If result is a task, we need to get the result so that exceptions are bubbled up in case the task is faulted.
Task t = result as Task;
if (t != null)
{
t.GetAwaiter().GetResult();
}
WriteBodyContentsAsyncResult thisPtr = (WriteBodyContentsAsyncResult)result.AsyncState;
thisPtr.writer.WriteEndElement();
return true;

View File

@@ -7,6 +7,7 @@ namespace System.ServiceModel.Channels
using System;
using System.IO;
using System.Runtime;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
@@ -15,6 +16,7 @@ namespace System.ServiceModel.Channels
bool ownsStream;
ByteStreamWriterState state;
Stream stream;
XmlWriterSettings settings;
public XmlByteStreamWriter(Stream stream, bool ownsStream)
{
@@ -30,6 +32,24 @@ namespace System.ServiceModel.Channels
get { return ByteStreamWriterStateToWriteState(this.state); }
}
public override XmlWriterSettings Settings
{
get
{
if (settings == null)
{
XmlWriterSettings newSettings = new XmlWriterSettings()
{
Async = true
};
Interlocked.CompareExchange<XmlWriterSettings>(ref this.settings, newSettings, null);
}
return this.settings;
}
}
public override void Close()
{
if (this.state != ByteStreamWriterState.Closed)