Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Connew <mconnew@microsoft.com>2017-10-26 23:58:29 +0300
committerMatt Connew <mconnew@microsoft.com>2017-10-27 20:46:31 +0300
commitfc82aed8f5a7af4968debb2682416f6aa25ca2d9 (patch)
tree441959135e7808211c5998c46314f5e596b32566 /src
parent3deef79652ee5abb5e6dc2d6741fa5f9e5fbd89f (diff)
Use ConfigureAwait(false) for all await's
Diffstat (limited to 'src')
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs367
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs7
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs30
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs191
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs3
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs5
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs529
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs7
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs3
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs9
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs21
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs15
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs21
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs33
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs2
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs11
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs2
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs2
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs1
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs93
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs17
-rw-r--r--src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs16
33 files changed, 667 insertions, 729 deletions
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs
index 3a3407164e..8e97a5a71f 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Channels
{
using System.Threading;
using System.Globalization;
- using System.ServiceModel;
internal class UriGenerator
{
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs
index e24f341c4c..ef0e4aa57d 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs
@@ -8,7 +8,6 @@ namespace System.ServiceModel.Syndication
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
- using System.Runtime.CompilerServices;
using System.ServiceModel.Channels;
using System.Threading;
using System.Threading.Tasks;
@@ -144,7 +143,7 @@ namespace System.ServiceModel.Syndication
}
SetFeed(CreateFeedInstance());
- await ReadFeedFromAsync(XmlReaderWrapper.CreateFromReader(reader), Feed, false);
+ await ReadFeedFromAsync(XmlReaderWrapper.CreateFromReader(reader), Feed, false).ConfigureAwait(false);
}
public override async Task WriteToAsync(XmlWriter writer, CancellationToken ct)
@@ -156,20 +155,20 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(Atom10Constants.FeedTag, Atom10Constants.Atom10Namespace);
- await WriteFeedAsync(writer);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(Atom10Constants.FeedTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
+ await WriteFeedAsync(writer).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
internal static async Task<SyndicationCategory> ReadCategoryAsync(XmlReader reader, SyndicationCategory category, string version, bool preserveAttributeExtensions, bool preserveElementExtensions, int _maxExtensionSize)
{
- await MoveToStartElementAsync(reader);
+ await MoveToStartElementAsync(reader).ConfigureAwait(false);
bool isEmpty = reader.IsEmptyElement;
if (reader.HasAttributes)
{
while (reader.MoveToNextAttribute())
{
- string value = await reader.GetValueAsync();
+ string value = await reader.GetValueAsync().ConfigureAwait(false);
bool notHandled = false;
if (reader.NamespaceURI == string.Empty)
@@ -220,12 +219,12 @@ namespace System.ServiceModel.Syndication
if (!isEmpty)
{
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
if (TryParseElement(reader, category, version))
{
@@ -233,11 +232,11 @@ namespace System.ServiceModel.Syndication
}
else if (!preserveElementExtensions)
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
else
{
- var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
@@ -249,15 +248,15 @@ namespace System.ServiceModel.Syndication
{
if (extWriter != null)
{
- ((IDisposable)extWriter).Dispose();
+ ((IDisposable) extWriter).Dispose();
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
else
{
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
}
return category;
@@ -271,36 +270,36 @@ namespace System.ServiceModel.Syndication
internal static async Task WriteCategoryAsync(XmlWriter writer, SyndicationCategory category, string version)
{
- await writer.WriteStartElementAsync(Atom10Constants.CategoryTag, Atom10Constants.Atom10Namespace);
- await WriteAttributeExtensionsAsync(writer, category, version);
+ await writer.WriteStartElementAsync(Atom10Constants.CategoryTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
+ await WriteAttributeExtensionsAsync(writer, category, version).ConfigureAwait(false);
string categoryName = category.Name ?? string.Empty;
if (!category.AttributeExtensions.ContainsKey(s_atom10Term))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.TermTag, categoryName);
+ await writer.WriteAttributeStringAsync(Atom10Constants.TermTag, categoryName).ConfigureAwait(false);
}
if (!string.IsNullOrEmpty(category.Label) && !category.AttributeExtensions.ContainsKey(s_atom10Label))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.LabelTag, category.Label);
+ await writer.WriteAttributeStringAsync(Atom10Constants.LabelTag, category.Label).ConfigureAwait(false);
}
if (!string.IsNullOrEmpty(category.Scheme) && !category.AttributeExtensions.ContainsKey(s_atom10Scheme))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.SchemeTag, category.Scheme);
+ await writer.WriteAttributeStringAsync(Atom10Constants.SchemeTag, category.Scheme).ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(writer, category, version);
- await writer.WriteEndElementAsync();
+ await WriteElementExtensionsAsync(writer, category, version).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
internal async Task ReadItemFromAsync(XmlReader reader, SyndicationItem result)
{
- await ReadItemFromAsync(reader, result, null);
+ await ReadItemFromAsync(reader, result, null).ConfigureAwait(false);
}
internal async Task<bool> TryParseFeedElementFromAsync(XmlReader reader, SyndicationFeed result)
{
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
return false;
}
@@ -313,42 +312,42 @@ namespace System.ServiceModel.Syndication
switch (name)
{
case Atom10Constants.AuthorTag:
- result.Authors.Add(await ReadPersonFromAsync(reader, result));
+ result.Authors.Add(await ReadPersonFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.CategoryTag:
- result.Categories.Add(await ReadCategoryFromAsync(reader, result));
+ result.Categories.Add(await ReadCategoryFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.ContributorTag:
- result.Contributors.Add(await ReadPersonFromAsync(reader, result));
+ result.Contributors.Add(await ReadPersonFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.GeneratorTag:
- result.Generator = StringParser(await reader.ReadElementStringAsync(), Atom10Constants.GeneratorTag,ns);
+ result.Generator = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Atom10Constants.GeneratorTag, ns);
break;
case Atom10Constants.IdTag:
- result.Id = StringParser(await reader.ReadElementStringAsync(), Atom10Constants.IdTag,ns);
+ result.Id = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Atom10Constants.IdTag, ns);
break;
case Atom10Constants.LinkTag:
- result.Links.Add(await ReadLinkFromAsync(reader, result));
+ result.Links.Add(await ReadLinkFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.LogoTag:
- result.ImageUrl = UriParser(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute, Atom10Constants.LogoTag, ns);
+ result.ImageUrl = UriParser(await reader.ReadElementStringAsync().ConfigureAwait(false), UriKind.RelativeOrAbsolute, Atom10Constants.LogoTag, ns);
break;
case Atom10Constants.RightsTag:
- result.Copyright = await ReadTextContentFromAsync(reader, "//atom:feed/atom:rights[@type]");
+ result.Copyright = await ReadTextContentFromAsync(reader, "//atom:feed/atom:rights[@type]").ConfigureAwait(false);
break;
case Atom10Constants.SubtitleTag:
- result.Description = await ReadTextContentFromAsync(reader, "//atom:feed/atom:subtitle[@type]");
+ result.Description = await ReadTextContentFromAsync(reader, "//atom:feed/atom:subtitle[@type]").ConfigureAwait(false);
break;
case Atom10Constants.TitleTag:
- result.Title = await ReadTextContentFromAsync(reader, "//atom:feed/atom:title[@type]");
+ result.Title = await ReadTextContentFromAsync(reader, "//atom:feed/atom:title[@type]").ConfigureAwait(false);
break;
case Atom10Constants.UpdatedTag:
- await reader.ReadStartElementAsync();
- result.LastUpdatedTime = DateTimeParser(await reader.ReadStringAsync(), Atom10Constants.UpdatedTag, ns);
- await reader.ReadEndElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
+ result.LastUpdatedTime = DateTimeParser(await reader.ReadStringAsync().ConfigureAwait(false), Atom10Constants.UpdatedTag, ns);
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
break;
case Atom10Constants.IconTag:
- result.IconImage = UriParser(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute, Atom10Constants.IconTag, ns);
+ result.IconImage = UriParser(await reader.ReadElementStringAsync().ConfigureAwait(false), UriKind.RelativeOrAbsolute, Atom10Constants.IconTag, ns);
break;
default:
return false;
@@ -362,7 +361,7 @@ namespace System.ServiceModel.Syndication
internal async Task<bool> TryParseItemElementFromAsync(XmlReader reader, SyndicationItem result)
{
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
return false;
}
@@ -375,46 +374,46 @@ namespace System.ServiceModel.Syndication
switch (name)
{
case Atom10Constants.AuthorTag:
- result.Authors.Add(await ReadPersonFromAsync(reader, result));
+ result.Authors.Add(await ReadPersonFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.CategoryTag:
- result.Categories.Add(await ReadCategoryFromAsync(reader, result));
+ result.Categories.Add(await ReadCategoryFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.ContentTag:
- result.Content = await ReadContentFromAsync(reader, result);
+ result.Content = await ReadContentFromAsync(reader, result).ConfigureAwait(false);
break;
case Atom10Constants.ContributorTag:
- result.Contributors.Add(await ReadPersonFromAsync(reader, result));
+ result.Contributors.Add(await ReadPersonFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.IdTag:
- result.Id = StringParser(await reader.ReadElementStringAsync(), Atom10Constants.IdTag, ns);
+ result.Id = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Atom10Constants.IdTag, ns);
break;
case Atom10Constants.LinkTag:
- result.Links.Add(await ReadLinkFromAsync(reader, result));
+ result.Links.Add(await ReadLinkFromAsync(reader, result).ConfigureAwait(false));
break;
case Atom10Constants.PublishedTag:
- await reader.ReadStartElementAsync();
- result.PublishDate = DateTimeParser(await reader.ReadStringAsync(), Atom10Constants.UpdatedTag, ns);
- await reader.ReadEndElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
+ result.PublishDate = DateTimeParser(await reader.ReadStringAsync().ConfigureAwait(false), Atom10Constants.UpdatedTag, ns);
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
break;
case Atom10Constants.RightsTag:
- result.Copyright = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:rights[@type]");
+ result.Copyright = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:rights[@type]").ConfigureAwait(false);
break;
case Atom10Constants.SourceFeedTag:
- await reader.ReadStartElementAsync();
- result.SourceFeed = await ReadFeedFromAsync(reader, new SyndicationFeed(), true); // isSourceFeed
- await reader.ReadEndElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
+ result.SourceFeed = await ReadFeedFromAsync(reader, new SyndicationFeed(), true).ConfigureAwait(false); // isSourceFeed
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
break;
case Atom10Constants.SummaryTag:
- result.Summary = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:summary[@type]");
+ result.Summary = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:summary[@type]").ConfigureAwait(false);
break;
case Atom10Constants.TitleTag:
- result.Title = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:title[@type]");
+ result.Title = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:title[@type]").ConfigureAwait(false);
break;
case Atom10Constants.UpdatedTag:
- await reader.ReadStartElementAsync();
- result.LastUpdatedTime = DateTimeParser(await reader.ReadStringAsync(), Atom10Constants.UpdatedTag, ns);
- await reader.ReadEndElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
+ result.LastUpdatedTime = DateTimeParser(await reader.ReadStringAsync().ConfigureAwait(false), Atom10Constants.UpdatedTag, ns);
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
break;
default:
return false;
@@ -439,7 +438,7 @@ namespace System.ServiceModel.Syndication
{
if (value != null)
{
- await writer.WriteElementStringAsync(elementName, Atom10Constants.Atom10Namespace, value);
+ await writer.WriteElementStringAsync(elementName, Atom10Constants.Atom10Namespace, value).ConfigureAwait(false);
}
}
@@ -449,7 +448,7 @@ namespace System.ServiceModel.Syndication
for (int i = 0; i < authors.Count; ++i)
{
SyndicationPerson p = authors[i];
- await WritePersonToAsync(writer, p, Atom10Constants.AuthorTag);
+ await WritePersonToAsync(writer, p, Atom10Constants.AuthorTag).ConfigureAwait(false);
}
}
@@ -459,7 +458,7 @@ namespace System.ServiceModel.Syndication
for (int i = 0; i < contributors.Count; ++i)
{
SyndicationPerson p = contributors[i];
- await WritePersonToAsync(writer, p, Atom10Constants.ContributorTag);
+ await WritePersonToAsync(writer, p, Atom10Constants.ContributorTag).ConfigureAwait(false);
}
}
@@ -484,7 +483,7 @@ namespace System.ServiceModel.Syndication
for (int i = 0; i < authors.Count; ++i)
{
SyndicationPerson p = authors[i];
- await WritePersonToAsync(writer, p, Atom10Constants.AuthorTag);
+ await WritePersonToAsync(writer, p, Atom10Constants.AuthorTag).ConfigureAwait(false);
}
}
@@ -501,7 +500,7 @@ namespace System.ServiceModel.Syndication
for (int i = 0; i < contributors.Count; ++i)
{
SyndicationPerson p = contributors[i];
- await WritePersonToAsync(writer, p, Atom10Constants.ContributorTag);
+ await WritePersonToAsync(writer, p, Atom10Constants.ContributorTag).ConfigureAwait(false);
}
}
@@ -512,48 +511,46 @@ namespace System.ServiceModel.Syndication
lastUpdatedTime = DateTimeOffset.UtcNow;
}
- return writer.WriteElementStringAsync(Atom10Constants.UpdatedTag,
- Atom10Constants.Atom10Namespace,
- AsString(lastUpdatedTime));
+ return writer.WriteElementStringAsync(Atom10Constants.UpdatedTag, Atom10Constants.Atom10Namespace, AsString(lastUpdatedTime));
}
internal async Task WriteLinkAsync(XmlWriter writer, SyndicationLink link, Uri baseUri)
{
- await writer.WriteStartElementAsync(Atom10Constants.LinkTag, Atom10Constants.Atom10Namespace);
+ await writer.WriteStartElementAsync(Atom10Constants.LinkTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, link.BaseUri);
if (baseUriToWrite != null)
{
- await writer.WriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(baseUriToWrite));
+ await writer.WriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(baseUriToWrite)).ConfigureAwait(false);
}
- await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Atom10);
+ await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Atom10).ConfigureAwait(false);
if (!string.IsNullOrEmpty(link.RelationshipType) && !link.AttributeExtensions.ContainsKey(s_atom10Relative))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.RelativeTag, link.RelationshipType);
+ await writer.WriteAttributeStringAsync(Atom10Constants.RelativeTag, link.RelationshipType).ConfigureAwait(false);
}
if (!string.IsNullOrEmpty(link.MediaType) && !link.AttributeExtensions.ContainsKey(s_atom10Type))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.TypeTag, link.MediaType);
+ await writer.WriteAttributeStringAsync(Atom10Constants.TypeTag, link.MediaType).ConfigureAwait(false);
}
if (!string.IsNullOrEmpty(link.Title) && !link.AttributeExtensions.ContainsKey(s_atom10Title))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.TitleTag, link.Title);
+ await writer.WriteAttributeStringAsync(Atom10Constants.TitleTag, link.Title).ConfigureAwait(false);
}
if (link.Length != 0 && !link.AttributeExtensions.ContainsKey(s_atom10Length))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.LengthTag, Convert.ToString(link.Length, CultureInfo.InvariantCulture));
+ await writer.WriteAttributeStringAsync(Atom10Constants.LengthTag, Convert.ToString(link.Length, CultureInfo.InvariantCulture)).ConfigureAwait(false);
}
if (!link.AttributeExtensions.ContainsKey(s_atom10Href))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.HrefTag, FeedUtils.GetUriString(link.Uri));
+ await writer.WriteAttributeStringAsync(Atom10Constants.HrefTag, FeedUtils.GetUriString(link.Uri)).ConfigureAwait(false);
}
- await link.WriteElementExtensionsAsync(writer, SyndicationVersions.Atom10);
- await writer.WriteEndElementAsync();
+ await link.WriteElementExtensionsAsync(writer, SyndicationVersions.Atom10).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
protected override SyndicationFeed CreateFeedInstance()
@@ -587,7 +584,7 @@ namespace System.ServiceModel.Syndication
SyndicationItem item = CreateItem(feed);
reader = XmlReaderWrapper.CreateFromReader(reader);
- await ReadItemFromAsync(reader, item, feed.BaseUri);
+ await ReadItemFromAsync(reader, item, feed.BaseUri).ConfigureAwait(false);
return item;
}
@@ -607,9 +604,9 @@ namespace System.ServiceModel.Syndication
NullNotAllowedCollection<SyndicationItem> items = new NullNotAllowedCollection<SyndicationItem>();
reader = XmlReaderWrapper.CreateFromReader(reader);
- while (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace))
+ while (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false))
{
- items.Add(await ReadItemAsync(reader, feed));
+ items.Add(await ReadItemAsync(reader, feed).ConfigureAwait(false));
}
return items;
@@ -628,9 +625,9 @@ namespace System.ServiceModel.Syndication
protected virtual async Task WriteItemAsync(XmlWriter writer, SyndicationItem item, Uri feedBaseUri)
{
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace);
- await WriteItemContentsAsync(writer, item, feedBaseUri);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
+ await WriteItemContentsAsync(writer, item, feedBaseUri).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
protected virtual async Task WriteItemsAsync(XmlWriter writer, IEnumerable<SyndicationItem> items, Uri feedBaseUri)
@@ -642,7 +639,7 @@ namespace System.ServiceModel.Syndication
foreach (SyndicationItem item in items)
{
- await WriteItemAsync(writer, item, feedBaseUri);
+ await WriteItemAsync(writer, item, feedBaseUri).ConfigureAwait(false);
}
}
@@ -686,7 +683,7 @@ namespace System.ServiceModel.Syndication
}
if (preserveAttributeExtensions)
{
- string value = await reader.GetValueAsync();
+ string value = await reader.GetValueAsync().ConfigureAwait(false);
if (attrs == null)
{
attrs = new Dictionary<XmlQualifiedName, string>();
@@ -698,7 +695,7 @@ namespace System.ServiceModel.Syndication
reader.MoveToElement();
string localName = reader.LocalName;
string nameSpace = reader.NamespaceURI;
- string val = (kind == TextSyndicationContentKind.XHtml) ? await reader.ReadInnerXmlAsync() : StringParser(await reader.ReadElementStringAsync(), localName, nameSpace); // cant custom parse because its static
+ string val = (kind == TextSyndicationContentKind.XHtml) ? await reader.ReadInnerXmlAsync().ConfigureAwait(false) : StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), localName, nameSpace); // cant custom parse because its static
TextSyndicationContent result = new TextSyndicationContent(val, kind);
if (attrs != null)
{
@@ -740,13 +737,13 @@ namespace System.ServiceModel.Syndication
private async Task<SyndicationCategory> ReadCategoryFromAsync(XmlReader reader, SyndicationItem item)
{
SyndicationCategory result = CreateCategory(item);
- await ReadCategoryAsync(reader, result);
+ await ReadCategoryAsync(reader, result).ConfigureAwait(false);
return result;
}
private async Task<SyndicationContent> ReadContentFromAsync(XmlReader reader, SyndicationItem item)
{
- await MoveToStartElementAsync(reader);
+ await MoveToStartElementAsync(reader).ConfigureAwait(false);
string type = reader.GetAttribute(Atom10Constants.TypeTag, string.Empty);
SyndicationContent result;
@@ -786,7 +783,7 @@ namespace System.ServiceModel.Syndication
{
if (_preserveAttributeExtensions)
{
- result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync());
+ result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync().ConfigureAwait(false));
}
else
{
@@ -796,30 +793,30 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmpty)
{
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
return result;
}
else
{
- return await ReadTextContentFromHelperAsync(reader, type, "//atom:feed/atom:entry/atom:content[@type]", _preserveAttributeExtensions);
+ return await ReadTextContentFromHelperAsync(reader, type, "//atom:feed/atom:entry/atom:content[@type]", _preserveAttributeExtensions).ConfigureAwait(false);
}
}
private async Task<SyndicationFeed> ReadFeedFromAsync(XmlReader reader, SyndicationFeed result, bool isSourceFeed)
{
- await reader.MoveToContentAsync();
+ await reader.MoveToContentAsync().ConfigureAwait(false);
//fix to accept non contiguous items
NullNotAllowedCollection<SyndicationItem> feedItems = new NullNotAllowedCollection<SyndicationItem>();
bool elementIsEmpty = false;
if (!isSourceFeed)
{
- await MoveToStartElementAsync(reader);
+ await MoveToStartElementAsync(reader).ConfigureAwait(false);
elementIsEmpty = reader.IsEmptyElement;
if (reader.HasAttributes)
{
@@ -827,11 +824,11 @@ namespace System.ServiceModel.Syndication
{
if (reader.LocalName == "lang" && reader.NamespaceURI == XmlNs)
{
- result.Language = await reader.GetValueAsync();
+ result.Language = await reader.GetValueAsync().ConfigureAwait(false);
}
else if (reader.LocalName == "base" && reader.NamespaceURI == XmlNs)
{
- result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync());
+ result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
}
else
{
@@ -842,7 +839,7 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
@@ -854,7 +851,7 @@ namespace System.ServiceModel.Syndication
}
}
}
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
}
XmlBuffer buffer = null;
@@ -864,17 +861,17 @@ namespace System.ServiceModel.Syndication
{
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
- if (await TryParseFeedElementFromAsync(reader, result))
+ if (await TryParseFeedElementFromAsync(reader, result).ConfigureAwait(false))
{
// nothing, we parsed something, great
}
- else if (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace) && !isSourceFeed)
+ else if (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false) && !isSourceFeed)
{
- while (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace))
+ while (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false))
{
- feedItems.Add(await ReadItemAsync(reader, result));
+ feedItems.Add(await ReadItemAsync(reader, result).ConfigureAwait(false));
}
}
else
@@ -883,13 +880,13 @@ namespace System.ServiceModel.Syndication
{
if (_preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -910,13 +907,13 @@ namespace System.ServiceModel.Syndication
{
if (extWriter != null)
{
- ((IDisposable)extWriter).Dispose();
+ ((IDisposable) extWriter).Dispose();
}
}
}
if (!isSourceFeed)
{
- await reader.ReadEndElementAsync(); // feed
+ await reader.ReadEndElementAsync().ConfigureAwait(false); // feed
}
return result;
@@ -927,7 +924,7 @@ namespace System.ServiceModel.Syndication
try
{
result.BaseUri = feedBaseUri;
- await MoveToStartElementAsync(reader);
+ await MoveToStartElementAsync(reader).ConfigureAwait(false);
bool isEmpty = reader.IsEmptyElement;
if (reader.HasAttributes)
{
@@ -937,7 +934,7 @@ namespace System.ServiceModel.Syndication
string name = reader.LocalName;
if (name == "base" && ns == XmlNs)
{
- result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync());
+ result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
continue;
}
@@ -946,7 +943,7 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
if (_preserveAttributeExtensions)
@@ -956,7 +953,7 @@ namespace System.ServiceModel.Syndication
}
}
}
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmpty)
{
@@ -964,9 +961,9 @@ namespace System.ServiceModel.Syndication
XmlDictionaryWriter extWriter = null;
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
- if (await TryParseItemElementFromAsync(reader, result))
+ if (await TryParseItemElementFromAsync(reader, result).ConfigureAwait(false))
{
// nothing, we parsed something, great
}
@@ -976,13 +973,13 @@ namespace System.ServiceModel.Syndication
{
if (_preserveElementExtensions)
{
- var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -993,10 +990,10 @@ namespace System.ServiceModel.Syndication
{
if (extWriter != null)
{
- ((IDisposable)extWriter).Dispose();
+ ((IDisposable) extWriter).Dispose();
}
}
- await reader.ReadEndElementAsync(); // item
+ await reader.ReadEndElementAsync().ConfigureAwait(false); // item
}
}
catch (FormatException e)
@@ -1026,26 +1023,26 @@ namespace System.ServiceModel.Syndication
bool notHandled = false;
if (reader.LocalName == "base" && reader.NamespaceURI == XmlNs)
{
- link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync());
+ link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
}
else if (reader.NamespaceURI == string.Empty)
{
switch (reader.LocalName)
{
case Atom10Constants.TypeTag:
- mediaType = await reader.GetValueAsync();
+ mediaType = await reader.GetValueAsync().ConfigureAwait(false);
break;
case Atom10Constants.RelativeTag:
- relationship = await reader.GetValueAsync();
+ relationship = await reader.GetValueAsync().ConfigureAwait(false);
break;
case Atom10Constants.TitleTag:
- title = await reader.GetValueAsync();
+ title = await reader.GetValueAsync().ConfigureAwait(false);
break;
case Atom10Constants.LengthTag:
- lengthStr = await reader.GetValueAsync();
+ lengthStr = await reader.GetValueAsync().ConfigureAwait(false);
break;
case Atom10Constants.HrefTag:
- val = await reader.GetValueAsync();
+ val = await reader.GetValueAsync().ConfigureAwait(false);
ns = reader.NamespaceURI;
break;
default:
@@ -1062,7 +1059,7 @@ namespace System.ServiceModel.Syndication
{
if (_preserveAttributeExtensions)
{
- link.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync());
+ link.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync().ConfigureAwait(false));
}
}
}
@@ -1074,14 +1071,14 @@ namespace System.ServiceModel.Syndication
length = Convert.ToInt64(lengthStr, CultureInfo.InvariantCulture.NumberFormat);
}
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmpty)
{
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
if (TryParseElement(reader, link, Version))
{
@@ -1089,11 +1086,11 @@ namespace System.ServiceModel.Syndication
}
else if (!_preserveElementExtensions)
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
else
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
@@ -1105,11 +1102,11 @@ namespace System.ServiceModel.Syndication
{
if (extWriter != null)
{
- ((IDisposable)extWriter).Dispose();
+ ((IDisposable) extWriter).Dispose();
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
link.Length = length;
@@ -1122,28 +1119,28 @@ namespace System.ServiceModel.Syndication
private async Task<SyndicationLink> ReadLinkFromAsync(XmlReader reader, SyndicationFeed feed)
{
SyndicationLink result = CreateLink(feed);
- await ReadLinkAsync(reader, result, feed.BaseUri);
+ await ReadLinkAsync(reader, result, feed.BaseUri).ConfigureAwait(false);
return result;
}
private async Task<SyndicationLink> ReadLinkFromAsync(XmlReader reader, SyndicationItem item)
{
SyndicationLink result = CreateLink(item);
- await ReadLinkAsync(reader, result, item.BaseUri);
+ await ReadLinkAsync(reader, result, item.BaseUri).ConfigureAwait(false);
return result;
}
private async Task<SyndicationPerson> ReadPersonFromAsync(XmlReader reader, SyndicationFeed feed)
{
SyndicationPerson result = CreatePerson(feed);
- await ReadPersonFromAsync(reader, result);
+ await ReadPersonFromAsync(reader, result).ConfigureAwait(false);
return result;
}
private async Task<SyndicationPerson> ReadPersonFromAsync(XmlReader reader, SyndicationItem item)
{
SyndicationPerson result = CreatePerson(item);
- await ReadPersonFromAsync(reader, result);
+ await ReadPersonFromAsync(reader, result).ConfigureAwait(false);
return result;
}
@@ -1160,25 +1157,25 @@ namespace System.ServiceModel.Syndication
{
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
if (_preserveAttributeExtensions)
{
- result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync());
+ result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync().ConfigureAwait(false));
}
}
}
}
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmpty)
{
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
string name = reader.LocalName;
string ns = reader.NamespaceURI;
@@ -1187,13 +1184,13 @@ namespace System.ServiceModel.Syndication
switch (name)
{
case Atom10Constants.NameTag:
- result.Name = StringParser(await reader.ReadElementStringAsync(), Atom10Constants.NameTag, ns);
+ result.Name = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Atom10Constants.NameTag, ns);
break;
case Atom10Constants.UriTag:
- result.Uri = StringParser(await reader.ReadElementStringAsync(), Atom10Constants.UriTag, ns);
+ result.Uri = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Atom10Constants.UriTag, ns);
break;
case Atom10Constants.EmailTag:
- result.Email = StringParser(await reader.ReadElementStringAsync(), Atom10Constants.EmailTag, ns);
+ result.Email = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Atom10Constants.EmailTag, ns);
break;
default:
notHandled = true;
@@ -1204,13 +1201,13 @@ namespace System.ServiceModel.Syndication
{
if (_preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -1221,11 +1218,11 @@ namespace System.ServiceModel.Syndication
{
if (extWriter != null)
{
- ((IDisposable)extWriter).Dispose();
+ ((IDisposable) extWriter).Dispose();
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
}
@@ -1239,7 +1236,7 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
for (int i = 0; i < categories.Count; ++i)
{
- await WriteCategoryAsync(writer, categories[i], Version);
+ await WriteCategoryAsync(writer, categories[i], Version).ConfigureAwait(false);
}
}
@@ -1258,13 +1255,13 @@ namespace System.ServiceModel.Syndication
{
if (!string.IsNullOrEmpty(feed.Language))
{
- await writer.WriteAttributeStringAsync("xml", "lang", XmlNs, feed.Language);
+ await writer.WriteAttributeStringAsync("xml", "lang", XmlNs, feed.Language).ConfigureAwait(false);
}
if (feed.BaseUri != null)
{
- await writer.WriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(feed.BaseUri));
+ await writer.WriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(feed.BaseUri)).ConfigureAwait(false);
}
- await WriteAttributeExtensionsAsync(writer, feed, Version);
+ await WriteAttributeExtensionsAsync(writer, feed, Version).ConfigureAwait(false);
}
bool isElementRequired = !isSourceFeed;
TextSyndicationContent title = feed.Title;
@@ -1272,40 +1269,40 @@ namespace System.ServiceModel.Syndication
{
title = title ?? new TextSyndicationContent(string.Empty);
}
- await WriteContentToAsync(writer, Atom10Constants.TitleTag, title);
- await WriteContentToAsync(writer, Atom10Constants.SubtitleTag, feed.Description);
+ await WriteContentToAsync(writer, Atom10Constants.TitleTag, title).ConfigureAwait(false);
+ await WriteContentToAsync(writer, Atom10Constants.SubtitleTag, feed.Description).ConfigureAwait(false);
string id = feed.Id;
if (isElementRequired)
{
id = id ?? s_idGenerator.Next();
}
- await WriteElementAsync(writer, Atom10Constants.IdTag, id);
- await WriteContentToAsync(writer, Atom10Constants.RightsTag, feed.Copyright);
- await WriteFeedLastUpdatedTimeToAsync(writer, feed.LastUpdatedTime, isElementRequired);
- await WriteCategoriesToAsync(writer, feed.Categories);
+ await WriteElementAsync(writer, Atom10Constants.IdTag, id).ConfigureAwait(false);
+ await WriteContentToAsync(writer, Atom10Constants.RightsTag, feed.Copyright).ConfigureAwait(false);
+ await WriteFeedLastUpdatedTimeToAsync(writer, feed.LastUpdatedTime, isElementRequired).ConfigureAwait(false);
+ await WriteCategoriesToAsync(writer, feed.Categories).ConfigureAwait(false);
if (feed.ImageUrl != null)
{
- await WriteElementAsync(writer, Atom10Constants.LogoTag, feed.ImageUrl.ToString());
+ await WriteElementAsync(writer, Atom10Constants.LogoTag, feed.ImageUrl.ToString()).ConfigureAwait(false);
}
- await WriteFeedAuthorsToAsync(writer, feed.Authors);
- await WriteFeedContributorsToAsync(writer, feed.Contributors);
- await WriteElementAsync(writer, Atom10Constants.GeneratorTag, feed.Generator);
+ await WriteFeedAuthorsToAsync(writer, feed.Authors).ConfigureAwait(false);
+ await WriteFeedContributorsToAsync(writer, feed.Contributors).ConfigureAwait(false);
+ await WriteElementAsync(writer, Atom10Constants.GeneratorTag, feed.Generator).ConfigureAwait(false);
if (feed.IconImage != null)
{
- await WriteElementAsync(writer, Atom10Constants.IconTag, feed.IconImage.AbsoluteUri);
+ await WriteElementAsync(writer, Atom10Constants.IconTag, feed.IconImage.AbsoluteUri).ConfigureAwait(false);
}
for (int i = 0; i < feed.Links.Count; ++i)
{
- await WriteLinkAsync(writer, feed.Links[i], feed.BaseUri);
+ await WriteLinkAsync(writer, feed.Links[i], feed.BaseUri).ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(writer, feed, Version);
+ await WriteElementExtensionsAsync(writer, feed, Version).ConfigureAwait(false);
if (!isSourceFeed)
{
- await WriteItemsAsync(writer, feed.Items, feed.BaseUri);
+ await WriteItemsAsync(writer, feed.Items, feed.BaseUri).ConfigureAwait(false);
}
}
@@ -1314,56 +1311,54 @@ namespace System.ServiceModel.Syndication
Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(feedBaseUri, item.BaseUri);
if (baseUriToWrite != null)
{
- await dictWriter.WriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(baseUriToWrite));
+ await dictWriter.WriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(baseUriToWrite)).ConfigureAwait(false);
}
- await WriteAttributeExtensionsAsync(dictWriter, item, Version);
+ await WriteAttributeExtensionsAsync(dictWriter, item, Version).ConfigureAwait(false);
string id = item.Id ?? s_idGenerator.Next();
- await WriteElementAsync(dictWriter, Atom10Constants.IdTag, id);
+ await WriteElementAsync(dictWriter, Atom10Constants.IdTag, id).ConfigureAwait(false);
TextSyndicationContent title = item.Title ?? new TextSyndicationContent(string.Empty);
- await WriteContentToAsync(dictWriter, Atom10Constants.TitleTag, title);
- await WriteContentToAsync(dictWriter, Atom10Constants.SummaryTag, item.Summary);
+ await WriteContentToAsync(dictWriter, Atom10Constants.TitleTag, title).ConfigureAwait(false);
+ await WriteContentToAsync(dictWriter, Atom10Constants.SummaryTag, item.Summary).ConfigureAwait(false);
if (item.PublishDate != DateTimeOffset.MinValue)
{
- await dictWriter.WriteElementStringAsync(Atom10Constants.PublishedTag,
- Atom10Constants.Atom10Namespace,
- AsString(item.PublishDate));
+ await dictWriter.WriteElementStringAsync(Atom10Constants.PublishedTag, Atom10Constants.Atom10Namespace, AsString(item.PublishDate)).ConfigureAwait(false);
}
- await WriteItemLastUpdatedTimeToAsync(dictWriter, item.LastUpdatedTime);
- await WriteItemAuthorsToAsync(dictWriter, item.Authors);
- await WriteItemContributorsToAsync(dictWriter, item.Contributors);
+ await WriteItemLastUpdatedTimeToAsync(dictWriter, item.LastUpdatedTime).ConfigureAwait(false);
+ await WriteItemAuthorsToAsync(dictWriter, item.Authors).ConfigureAwait(false);
+ await WriteItemContributorsToAsync(dictWriter, item.Contributors).ConfigureAwait(false);
for (int i = 0; i < item.Links.Count; ++i)
{
- await WriteLinkAsync(dictWriter, item.Links[i], item.BaseUri);
+ await WriteLinkAsync(dictWriter, item.Links[i], item.BaseUri).ConfigureAwait(false);
}
- await WriteCategoriesToAsync(dictWriter, item.Categories);
- await WriteContentToAsync(dictWriter, Atom10Constants.ContentTag, item.Content);
- await WriteContentToAsync(dictWriter, Atom10Constants.RightsTag, item.Copyright);
+ await WriteCategoriesToAsync(dictWriter, item.Categories).ConfigureAwait(false);
+ await WriteContentToAsync(dictWriter, Atom10Constants.ContentTag, item.Content).ConfigureAwait(false);
+ await WriteContentToAsync(dictWriter, Atom10Constants.RightsTag, item.Copyright).ConfigureAwait(false);
if (item.SourceFeed != null)
{
- await dictWriter.WriteStartElementAsync(Atom10Constants.SourceFeedTag, Atom10Constants.Atom10Namespace);
- await WriteFeedToAsync(dictWriter, item.SourceFeed, true); // isSourceFeed
- await dictWriter.WriteEndElementAsync();
+ await dictWriter.WriteStartElementAsync(Atom10Constants.SourceFeedTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
+ await WriteFeedToAsync(dictWriter, item.SourceFeed, true).ConfigureAwait(false); // isSourceFeed
+ await dictWriter.WriteEndElementAsync().ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(dictWriter, item, Version);
+ await WriteElementExtensionsAsync(dictWriter, item, Version).ConfigureAwait(false);
}
private async Task WritePersonToAsync(XmlWriter writer, SyndicationPerson p, string elementName)
{
- await writer.WriteStartElementAsync(elementName, Atom10Constants.Atom10Namespace);
- await WriteAttributeExtensionsAsync(writer, p, Version);
- await WriteElementAsync(writer, Atom10Constants.NameTag, p.Name);
+ await writer.WriteStartElementAsync(elementName, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
+ await WriteAttributeExtensionsAsync(writer, p, Version).ConfigureAwait(false);
+ await WriteElementAsync(writer, Atom10Constants.NameTag, p.Name).ConfigureAwait(false);
if (!string.IsNullOrEmpty(p.Uri))
{
- await writer.WriteElementStringAsync(Atom10Constants.UriTag, Atom10Constants.Atom10Namespace, p.Uri);
+ await writer.WriteElementStringAsync(Atom10Constants.UriTag, Atom10Constants.Atom10Namespace, p.Uri).ConfigureAwait(false);
}
if (!string.IsNullOrEmpty(p.Email))
{
- await writer.WriteElementStringAsync(Atom10Constants.EmailTag, Atom10Constants.Atom10Namespace, p.Email);
+ await writer.WriteElementStringAsync(Atom10Constants.EmailTag, Atom10Constants.Atom10Namespace, p.Email).ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(writer, p, Version);
- await writer.WriteEndElementAsync();
+ await WriteElementExtensionsAsync(writer, p, Version).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs
index d354fbc2e7..dfeefda128 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs
@@ -11,7 +11,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
@@ -153,9 +152,9 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace);
- await WriteItemAsync(writer);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
+ await WriteItemAsync(writer).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
protected override SyndicationItem CreateItemInstance()
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs
index 276e39e631..0308b389d0 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs
@@ -6,7 +6,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
@@ -142,7 +141,7 @@ namespace System.ServiceModel.Syndication
throw new XmlException(SR.Format(SR.UnknownDocumentXml, reader.LocalName, reader.NamespaceURI));
}
- await ReadDocumentAsync(XmlReaderWrapper.CreateFromReader(reader));
+ await ReadDocumentAsync(XmlReaderWrapper.CreateFromReader(reader)).ConfigureAwait(false);
}
public override async Task WriteToAsync(XmlWriter writer)
@@ -158,31 +157,31 @@ namespace System.ServiceModel.Syndication
}
writer.WriteStartElement(App10Constants.Prefix, App10Constants.Categories, App10Constants.Namespace);
- await WriteDocumentAsync(writer);
+ await WriteDocumentAsync(writer).ConfigureAwait(false);
writer.WriteEndElement();
}
protected override InlineCategoriesDocument CreateInlineCategoriesDocument()
{
- if (_inlineDocumentType == typeof(InlineCategoriesDocument))
+ if (_inlineDocumentType == typeof (InlineCategoriesDocument))
{
return new InlineCategoriesDocument();
}
else
{
- return (InlineCategoriesDocument)Activator.CreateInstance(_inlineDocumentType);
+ return (InlineCategoriesDocument) Activator.CreateInstance(_inlineDocumentType);
}
}
protected override ReferencedCategoriesDocument CreateReferencedCategoriesDocument()
{
- if (_referencedDocumentType == typeof(ReferencedCategoriesDocument))
+ if (_referencedDocumentType == typeof (ReferencedCategoriesDocument))
{
return new ReferencedCategoriesDocument();
}
else
{
- return (ReferencedCategoriesDocument)Activator.CreateInstance(_referencedDocumentType);
+ return (ReferencedCategoriesDocument) Activator.CreateInstance(_referencedDocumentType);
}
}
@@ -190,21 +189,8 @@ namespace System.ServiceModel.Syndication
{
try
{
- await SyndicationFeedFormatter.MoveToStartElementAsync(reader);
- SetDocument(await AtomPub10ServiceDocumentFormatter.ReadCategories(reader, null,
- delegate ()
- {
- return CreateInlineCategoriesDocument();
- },
-
- delegate ()
- {
- return CreateReferencedCategoriesDocument();
- },
- Version,
- _preserveElementExtensions,
- _preserveAttributeExtensions,
- _maxExtensionSize));
+ await SyndicationFeedFormatter.MoveToStartElementAsync(reader).ConfigureAwait(false);
+ SetDocument(await AtomPub10ServiceDocumentFormatter.ReadCategories(reader, null, delegate() { return CreateInlineCategoriesDocument(); }, delegate() { return CreateReferencedCategoriesDocument(); }, Version, _preserveElementExtensions, _preserveAttributeExtensions, _maxExtensionSize).ConfigureAwait(false));
}
catch (FormatException e)
{
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs
index 662343d409..797e265a27 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
@@ -132,14 +131,14 @@ namespace System.ServiceModel.Syndication
}
reader = XmlReaderWrapper.CreateFromReader(reader);
- await reader.MoveToContentAsync();
+ await reader.MoveToContentAsync().ConfigureAwait(false);
if (!CanRead(reader))
{
throw new XmlException(SR.Format(SR.UnknownDocumentXml, reader.LocalName, reader.NamespaceURI));
}
- await ReadDocumentAsync(reader);
+ await ReadDocumentAsync(reader).ConfigureAwait(false);
}
public override async Task WriteToAsync(XmlWriter writer)
@@ -156,9 +155,9 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Service, App10Constants.Namespace);
- await WriteDocumentAsync(writer);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Service, App10Constants.Namespace).ConfigureAwait(false);
+ await WriteDocumentAsync(writer).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
internal static async Task<CategoriesDocument> ReadCategories(XmlReader reader, Uri baseUri, CreateInlineCategoriesDelegate inlineCategoriesFactory, CreateReferencedCategoriesDelegate referencedCategoriesFactory, string version, bool preserveElementExtensions, bool preserveAttributeExtensions, int maxExtensionSize)
@@ -167,13 +166,13 @@ namespace System.ServiceModel.Syndication
if (string.IsNullOrEmpty(link))
{
InlineCategoriesDocument inlineCategories = inlineCategoriesFactory();
- await ReadInlineCategoriesAsync(reader, inlineCategories, baseUri, version, preserveElementExtensions, preserveAttributeExtensions, maxExtensionSize);
+ await ReadInlineCategoriesAsync(reader, inlineCategories, baseUri, version, preserveElementExtensions, preserveAttributeExtensions, maxExtensionSize).ConfigureAwait(false);
return inlineCategories;
}
else
{
ReferencedCategoriesDocument referencedCategories = referencedCategoriesFactory();
- await ReadReferencedCategoriesAsync(reader, referencedCategories, baseUri, new Uri(link, UriKind.RelativeOrAbsolute), version, preserveElementExtensions, preserveAttributeExtensions, maxExtensionSize);
+ await ReadReferencedCategoriesAsync(reader, referencedCategories, baseUri, new Uri(link, UriKind.RelativeOrAbsolute), version, preserveElementExtensions, preserveAttributeExtensions, maxExtensionSize).ConfigureAwait(false);
return referencedCategories;
}
}
@@ -193,23 +192,23 @@ namespace System.ServiceModel.Syndication
if (categories.IsInline)
{
- await WriteInlineCategoriesContentAsync(XmlWriterWrapper.CreateFromWriter(writer), (InlineCategoriesDocument)categories, version);
+ await WriteInlineCategoriesContentAsync(XmlWriterWrapper.CreateFromWriter(writer), (InlineCategoriesDocument) categories, version).ConfigureAwait(false);
}
else
{
- WriteReferencedCategoriesContent(writer, (ReferencedCategoriesDocument)categories, version);
+ WriteReferencedCategoriesContent(writer, (ReferencedCategoriesDocument) categories, version);
}
}
protected override ServiceDocument CreateDocumentInstance()
{
- if (_documentType == typeof(ServiceDocument))
+ if (_documentType == typeof (ServiceDocument))
{
return new ServiceDocument();
}
else
{
- return (ServiceDocument)Activator.CreateInstance(_documentType);
+ return (ServiceDocument) Activator.CreateInstance(_documentType);
}
}
@@ -222,11 +221,11 @@ namespace System.ServiceModel.Syndication
{
if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- inlineCategories.BaseUri = FeedUtils.CombineXmlBase(inlineCategories.BaseUri, await reader.GetValueAsync());
+ inlineCategories.BaseUri = FeedUtils.CombineXmlBase(inlineCategories.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
}
else if (reader.LocalName == "lang" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- inlineCategories.Language = await reader.GetValueAsync();
+ inlineCategories.Language = await reader.GetValueAsync().ConfigureAwait(false);
}
else if (reader.LocalName == App10Constants.Fixed && reader.NamespaceURI == string.Empty)
{
@@ -234,7 +233,7 @@ namespace System.ServiceModel.Syndication
}
else if (reader.LocalName == Atom10Constants.SchemeTag && reader.NamespaceURI == string.Empty)
{
- inlineCategories.Scheme = await reader.GetValueAsync();
+ inlineCategories.Scheme = await reader.GetValueAsync().ConfigureAwait(false);
}
else
{
@@ -244,33 +243,33 @@ namespace System.ServiceModel.Syndication
{
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, inlineCategories, version))
{
if (preserveAttributeExtensions)
{
- inlineCategories.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync());
+ inlineCategories.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync().ConfigureAwait(false));
}
}
}
}
}
- await SyndicationFeedFormatter.MoveToStartElementAsync(reader);
+ await SyndicationFeedFormatter.MoveToStartElementAsync(reader).ConfigureAwait(false);
bool isEmptyElement = reader.IsEmptyElement;
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmptyElement)
{
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
- if (await reader.IsStartElementAsync(Atom10Constants.CategoryTag, Atom10Constants.Atom10Namespace))
+ if (await reader.IsStartElementAsync(Atom10Constants.CategoryTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false))
{
SyndicationCategory category = CreateCategory(inlineCategories);
- await Atom10FeedFormatter.ReadCategoryAsync(reader, category, version, preserveAttributeExtensions, preserveElementExtensions, _maxExtensionSize);
+ await Atom10FeedFormatter.ReadCategoryAsync(reader, category, version, preserveAttributeExtensions, preserveElementExtensions, _maxExtensionSize).ConfigureAwait(false);
if (category.Scheme == null)
{
category.Scheme = inlineCategories.Scheme;
@@ -282,13 +281,13 @@ namespace System.ServiceModel.Syndication
{
if (preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -302,7 +301,7 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
}
@@ -316,11 +315,11 @@ namespace System.ServiceModel.Syndication
{
if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- referencedCategories.BaseUri = FeedUtils.CombineXmlBase(referencedCategories.BaseUri, await reader.GetValueAsync());
+ referencedCategories.BaseUri = FeedUtils.CombineXmlBase(referencedCategories.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
}
else if (reader.LocalName == "lang" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- referencedCategories.Language = await reader.GetValueAsync();
+ referencedCategories.Language = await reader.GetValueAsync().ConfigureAwait(false);
}
else if (reader.LocalName == App10Constants.Href && reader.NamespaceURI == string.Empty)
{
@@ -335,12 +334,12 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, referencedCategories, version))
{
if (preserveAttributeExtensions)
{
- referencedCategories.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync());
+ referencedCategories.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync().ConfigureAwait(false));
}
}
}
@@ -349,20 +348,20 @@ namespace System.ServiceModel.Syndication
reader.MoveToElement();
bool isEmptyElement = reader.IsEmptyElement;
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmptyElement)
{
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
if (!TryParseElement(reader, referencedCategories, version))
{
if (preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
@@ -379,15 +378,15 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
}
private static async Task WriteCategoriesAsync(XmlWriter writer, CategoriesDocument categories, Uri baseUri, string version)
{
- await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Categories, App10Constants.Namespace);
- await WriteCategoriesInnerXml(writer, categories, baseUri, version);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Categories, App10Constants.Namespace).ConfigureAwait(false);
+ await WriteCategoriesInnerXml(writer, categories, baseUri, version).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
private static async Task WriteInlineCategoriesContentAsync(XmlWriter writer, InlineCategoriesDocument categories, string version)
@@ -395,22 +394,22 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
if (!string.IsNullOrEmpty(categories.Scheme))
{
- await writer.WriteAttributeStringAsync(Atom10Constants.SchemeTag, categories.Scheme);
+ await writer.WriteAttributeStringAsync(Atom10Constants.SchemeTag, categories.Scheme).ConfigureAwait(false);
}
// by default, categories are not fixed
if (categories.IsFixed)
{
- await writer.WriteAttributeStringAsync(App10Constants.Fixed, "yes");
+ await writer.WriteAttributeStringAsync(App10Constants.Fixed, "yes").ConfigureAwait(false);
}
- await WriteAttributeExtensionsAsync(writer, categories, version);
+ await WriteAttributeExtensionsAsync(writer, categories, version).ConfigureAwait(false);
for (int i = 0; i < categories.Categories.Count; ++i)
{
- await Atom10FeedFormatter.WriteCategoryAsync(writer, categories.Categories[i], version);
+ await Atom10FeedFormatter.WriteCategoryAsync(writer, categories.Categories[i], version).ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(writer, categories, version);
+ await WriteElementExtensionsAsync(writer, categories, version).ConfigureAwait(false);
}
private static void WriteReferencedCategoriesContent(XmlWriter writer, ReferencedCategoriesDocument categories, string version)
@@ -444,11 +443,11 @@ namespace System.ServiceModel.Syndication
{
if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync());
+ result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
}
else if (reader.LocalName == App10Constants.Href && reader.NamespaceURI == string.Empty)
{
- result.Link = new Uri(await reader.GetValueAsync(), UriKind.RelativeOrAbsolute);
+ result.Link = new Uri(await reader.GetValueAsync().ConfigureAwait(false), UriKind.RelativeOrAbsolute);
}
else
{
@@ -459,7 +458,7 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
if (_preserveAttributeExtensions)
@@ -477,31 +476,17 @@ namespace System.ServiceModel.Syndication
reader.ReadStartElement();
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
- if (await reader.IsStartElementAsync(Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace))
+ if (await reader.IsStartElementAsync(Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false))
{
- result.Title = await new Atom10FeedFormatter().ReadTextContentFromAsync(reader, "//app:service/app:workspace/app:collection/atom:title[@type]", _preserveAttributeExtensions);
+ result.Title = await new Atom10FeedFormatter().ReadTextContentFromAsync(reader, "//app:service/app:workspace/app:collection/atom:title[@type]", _preserveAttributeExtensions).ConfigureAwait(false);
}
- else if (await reader.IsStartElementAsync(App10Constants.Categories, App10Constants.Namespace))
+ else if (await reader.IsStartElementAsync(App10Constants.Categories, App10Constants.Namespace).ConfigureAwait(false))
{
- result.Categories.Add(await ReadCategories(reader,
- result.BaseUri,
- delegate ()
- {
- return CreateInlineCategories(result);
- },
-
- delegate ()
- {
- return CreateReferencedCategories(result);
- },
- Version,
- _preserveElementExtensions,
- _preserveAttributeExtensions,
- _maxExtensionSize));
+ result.Categories.Add(await ReadCategories(reader, result.BaseUri, delegate() { return CreateInlineCategories(result); }, delegate() { return CreateReferencedCategories(result); }, Version, _preserveElementExtensions, _preserveAttributeExtensions, _maxExtensionSize).ConfigureAwait(false));
}
- else if (await reader.IsStartElementAsync(App10Constants.Accept, App10Constants.Namespace))
+ else if (await reader.IsStartElementAsync(App10Constants.Accept, App10Constants.Namespace).ConfigureAwait(false))
{
result.Accepts.Add(reader.ReadElementString());
}
@@ -509,7 +494,7 @@ namespace System.ServiceModel.Syndication
{
if (_preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
@@ -539,7 +524,7 @@ namespace System.ServiceModel.Syndication
ServiceDocument result = CreateDocumentInstance();
try
{
- await SyndicationFeedFormatter.MoveToStartElementAsync(reader);
+ await SyndicationFeedFormatter.MoveToStartElementAsync(reader).ConfigureAwait(false);
bool elementIsEmpty = reader.IsEmptyElement;
if (reader.HasAttributes)
{
@@ -547,11 +532,11 @@ namespace System.ServiceModel.Syndication
{
if (reader.LocalName == "lang" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- result.Language = await reader.GetValueAsync();
+ result.Language = await reader.GetValueAsync().ConfigureAwait(false);
}
else if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- result.BaseUri = new Uri(await reader.GetValueAsync(), UriKind.RelativeOrAbsolute);
+ result.BaseUri = new Uri(await reader.GetValueAsync().ConfigureAwait(false), UriKind.RelativeOrAbsolute);
}
else
{
@@ -562,7 +547,7 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
if (_preserveAttributeExtensions)
@@ -576,28 +561,28 @@ namespace System.ServiceModel.Syndication
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!elementIsEmpty)
{
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
- if (await reader.IsStartElementAsync(App10Constants.Workspace, App10Constants.Namespace))
+ if (await reader.IsStartElementAsync(App10Constants.Workspace, App10Constants.Namespace).ConfigureAwait(false))
{
- result.Workspaces.Add(await ReadWorkspaceAsync(reader, result));
+ result.Workspaces.Add(await ReadWorkspaceAsync(reader, result).ConfigureAwait(false));
}
else if (!TryParseElement(reader, result, Version))
{
if (_preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -613,7 +598,7 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
catch (FormatException e)
{
@@ -637,7 +622,7 @@ namespace System.ServiceModel.Syndication
{
if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync());
+ result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
}
else
{
@@ -648,7 +633,7 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
if (_preserveAttributeExtensions)
@@ -662,30 +647,30 @@ namespace System.ServiceModel.Syndication
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
- if (await reader.IsStartElementAsync(Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace))
+ if (await reader.IsStartElementAsync(Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false))
{
- result.Title = await new Atom10FeedFormatter().ReadTextContentFromAsync(reader, "//app:service/app:workspace/atom:title[@type]", _preserveAttributeExtensions);
+ result.Title = await new Atom10FeedFormatter().ReadTextContentFromAsync(reader, "//app:service/app:workspace/atom:title[@type]", _preserveAttributeExtensions).ConfigureAwait(false);
}
- else if (await reader.IsStartElementAsync(App10Constants.Collection, App10Constants.Namespace))
+ else if (await reader.IsStartElementAsync(App10Constants.Collection, App10Constants.Namespace).ConfigureAwait(false))
{
- result.Collections.Add(await ReadCollectionAsync(reader, result));
+ result.Collections.Add(await ReadCollectionAsync(reader, result).ConfigureAwait(false));
}
else if (!TryParseElement(reader, result, Version))
{
if (_preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -700,13 +685,13 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
return result;
}
private async Task WriteCollectionAsync(XmlWriter writer, ResourceCollectionInfo collection, Uri baseUri)
{
- await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Collection, App10Constants.Namespace);
+ await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Collection, App10Constants.Namespace).ConfigureAwait(false);
Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, collection.BaseUri);
if (baseUriToWrite != null)
{
@@ -716,33 +701,33 @@ namespace System.ServiceModel.Syndication
if (collection.Link != null)
{
- await writer.WriteAttributeStringAsync(App10Constants.Href, FeedUtils.GetUriString(collection.Link));
+ await writer.WriteAttributeStringAsync(App10Constants.Href, FeedUtils.GetUriString(collection.Link)).ConfigureAwait(false);
}
- await WriteAttributeExtensionsAsync(writer, collection, Version);
+ await WriteAttributeExtensionsAsync(writer, collection, Version).ConfigureAwait(false);
if (collection.Title != null)
{
- await collection.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace);
+ await collection.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
}
for (int i = 0; i < collection.Accepts.Count; ++i)
{
- await writer.WriteElementStringAsync(App10Constants.Prefix, App10Constants.Accept, App10Constants.Namespace, collection.Accepts[i]);
+ await writer.WriteElementStringAsync(App10Constants.Prefix, App10Constants.Accept, App10Constants.Namespace, collection.Accepts[i]).ConfigureAwait(false);
}
for (int i = 0; i < collection.Categories.Count; ++i)
{
- await WriteCategoriesAsync(writer, collection.Categories[i], baseUri, Version);
+ await WriteCategoriesAsync(writer, collection.Categories[i], baseUri, Version).ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(writer, collection, Version);
- await writer.WriteEndElementAsync();
+ await WriteElementExtensionsAsync(writer, collection, Version).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
private async Task WriteDocumentAsync(XmlWriter writer)
{
// declare the atom10 namespace upfront for compactness
- await writer.WriteAttributeStringAsync(Atom10Constants.Atom10Prefix, Atom10FeedFormatter.XmlNsNs, Atom10Constants.Atom10Namespace);
+ await writer.WriteAttributeStringAsync(Atom10Constants.Atom10Prefix, Atom10FeedFormatter.XmlNsNs, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
if (!string.IsNullOrEmpty(Document.Language))
{
WriteXmlLang(writer, Document.Language);
@@ -758,15 +743,15 @@ namespace System.ServiceModel.Syndication
for (int i = 0; i < Document.Workspaces.Count; ++i)
{
- await WriteWorkspaceAsync(writer, Document.Workspaces[i], baseUri);
+ await WriteWorkspaceAsync(writer, Document.Workspaces[i], baseUri).ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(writer, Document, Version);
+ await WriteElementExtensionsAsync(writer, Document, Version).ConfigureAwait(false);
}
private async Task WriteWorkspaceAsync(XmlWriter writer, Workspace workspace, Uri baseUri)
{
- await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Workspace, App10Constants.Namespace);
+ await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Workspace, App10Constants.Namespace).ConfigureAwait(false);
Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, workspace.BaseUri);
if (baseUriToWrite != null)
{
@@ -777,16 +762,16 @@ namespace System.ServiceModel.Syndication
WriteAttributeExtensions(writer, workspace, Version);
if (workspace.Title != null)
{
- await workspace.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace);
+ await workspace.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
}
for (int i = 0; i < workspace.Collections.Count; ++i)
{
- await WriteCollectionAsync(writer, workspace.Collections[i], baseUri);
+ await WriteCollectionAsync(writer, workspace.Collections[i], baseUri).ConfigureAwait(false);
}
- await WriteElementExtensionsAsync(writer, workspace, Version);
- await writer.WriteEndElementAsync();
+ await WriteElementExtensionsAsync(writer, workspace, Version).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs
index f7ad89b659..f94048732e 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs
@@ -7,7 +7,6 @@ namespace System.ServiceModel.Syndication
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
@@ -77,7 +76,7 @@ namespace System.ServiceModel.Syndication
public static async Task<CategoriesDocument> LoadAsync(XmlReader reader)
{
AtomPub10CategoriesDocumentFormatter formatter = new AtomPub10CategoriesDocumentFormatter();
- await formatter.ReadFromAsync(reader);
+ await formatter.ReadFromAsync(reader).ConfigureAwait(false);
return formatter.Document;
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs
index 50a8f2cb38..2ee6b1f135 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Xml;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs
index 2aaf3c020e..972210b51a 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Xml;
using System.Threading.Tasks;
@@ -126,7 +125,7 @@ namespace System.ServiceModel.Syndication
foreach (XmlQualifiedName qname in _attributeExtensions.Keys)
{
string value = _attributeExtensions[qname];
- await writer.WriteAttributeStringAsync(qname.Name, qname.Namespace, value);
+ await writer.WriteAttributeStringAsync(qname.Name, qname.Namespace, value).ConfigureAwait(false);
}
}
}
@@ -140,7 +139,7 @@ namespace System.ServiceModel.Syndication
if (_elementExtensions != null)
{
- await _elementExtensions.WriteToAsync(writer);
+ await _elementExtensions.WriteToAsync(writer).ConfigureAwait(false);
}
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs
index 48cbb9ce60..12c6927203 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Syndication
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.Runtime.CompilerServices;
public class InlineCategoriesDocument : CategoriesDocument
{
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs
index 75686a2f30..b603cd51c0 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
public class ReferencedCategoriesDocument : CategoriesDocument
{
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs
index 7db7c4ae50..8f3afbcf71 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs
@@ -7,7 +7,6 @@ namespace System.ServiceModel.Syndication
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs
index 6e948a1785..09d660cc31 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs
@@ -36,29 +36,31 @@ namespace System.ServiceModel.Syndication
private async Task<bool> OnReadImage(XmlReader reader, SyndicationFeed result)
{
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
string localName = string.Empty;
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
- if (await reader.IsStartElementAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace))
+ if (await reader.IsStartElementAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false))
{
- result.ImageUrl = UriParser(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute, Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace);
+ result.ImageUrl = UriParser(await reader.ReadElementStringAsync().ConfigureAwait(false), UriKind.RelativeOrAbsolute, Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace);
}
- else if (await reader.IsStartElementAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace))
+ else if (await reader.IsStartElementAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false))
{
- result.ImageLink = UriParser(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute, Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace);
+ result.ImageLink = UriParser(await reader.ReadElementStringAsync().ConfigureAwait(false), UriKind.RelativeOrAbsolute, Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace);
}
- else if (await reader.IsStartElementAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace))
+ else if (await reader.IsStartElementAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false))
{
- result.ImageTitle = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace));
+ result.ImageTitle = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace));
}
}
- await reader.ReadEndElementAsync(); // image
+ await reader.ReadEndElementAsync().ConfigureAwait(false); // image
return true;
}
- public Rss20FeedFormatter() : this(typeof(SyndicationFeed)) { }
+ public Rss20FeedFormatter() : this(typeof (SyndicationFeed))
+ {
+ }
public Rss20FeedFormatter(Type feedTypeToCreate) : base()
{
@@ -66,7 +68,7 @@ namespace System.ServiceModel.Syndication
{
throw new ArgumentNullException(nameof(feedTypeToCreate));
}
- if (!typeof(SyndicationFeed).IsAssignableFrom(feedTypeToCreate))
+ if (!typeof (SyndicationFeed).IsAssignableFrom(feedTypeToCreate))
{
throw new ArgumentException(SR.Format(SR.InvalidObjectTypePassed, nameof(feedTypeToCreate), nameof(SyndicationFeed)));
}
@@ -79,7 +81,9 @@ namespace System.ServiceModel.Syndication
DateTimeParser = DateTimeHelper.CreateRss20DateTimeParser();
}
- public Rss20FeedFormatter(SyndicationFeed feedToWrite) : this(feedToWrite, true) { }
+ public Rss20FeedFormatter(SyndicationFeed feedToWrite) : this(feedToWrite, true)
+ {
+ }
public Rss20FeedFormatter(SyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) : base(feedToWrite)
{
@@ -118,10 +122,7 @@ namespace System.ServiceModel.Syndication
protected Type FeedType
{
- get
- {
- return _feedType;
- }
+ get { return _feedType; }
}
public override bool CanRead(XmlReader reader)
@@ -200,9 +201,9 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(Rss20Constants.RssTag, Rss20Constants.Rss20Namespace);
- await WriteFeedAsync(writer);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(Rss20Constants.RssTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
+ await WriteFeedAsync(writer).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
protected internal override void SetFeed(SyndicationFeed feed)
@@ -214,7 +215,7 @@ namespace System.ServiceModel.Syndication
private async Task ReadItemFromAsync(XmlReader reader, SyndicationItem result, Uri feedBaseUri)
{
result.BaseUri = feedBaseUri;
- await reader.MoveToContentAsync();
+ await reader.MoveToContentAsync().ConfigureAwait(false);
bool isEmpty = reader.IsEmptyElement;
if (reader.HasAttributes)
{
@@ -224,7 +225,7 @@ namespace System.ServiceModel.Syndication
string name = reader.LocalName;
if (name == "base" && ns == Atom10FeedFormatter.XmlNs)
{
- result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync());
+ result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
continue;
}
@@ -233,7 +234,7 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
if (_preserveAttributeExtensions)
@@ -244,7 +245,7 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmpty)
{
@@ -254,110 +255,110 @@ namespace System.ServiceModel.Syndication
try
{
XmlBuffer buffer = null;
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
bool notHandled = false;
- if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.NamespaceURI == Rss20Constants.Rss20Namespace)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) == XmlNodeType.Element && reader.NamespaceURI == Rss20Constants.Rss20Namespace)
{
switch (reader.LocalName)
{
case Rss20Constants.TitleTag:
- result.Title = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace));
+ result.Title = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace));
break;
case Rss20Constants.LinkTag:
- result.Links.Add(await ReadAlternateLinkAsync(reader, result.BaseUri));
+ result.Links.Add(await ReadAlternateLinkAsync(reader, result.BaseUri).ConfigureAwait(false));
readAlternateLink = true;
break;
case Rss20Constants.DescriptionTag:
- result.Summary = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace));
+ result.Summary = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace));
break;
case Rss20Constants.AuthorTag:
- result.Authors.Add(await ReadPersonAsync(reader, result));
+ result.Authors.Add(await ReadPersonAsync(reader, result).ConfigureAwait(false));
break;
case Rss20Constants.CategoryTag:
- result.Categories.Add(await ReadCategoryAsync(reader, result));
+ result.Categories.Add(await ReadCategoryAsync(reader, result).ConfigureAwait(false));
break;
case Rss20Constants.EnclosureTag:
- result.Links.Add(await ReadMediaEnclosureAsync(reader, result.BaseUri));
+ result.Links.Add(await ReadMediaEnclosureAsync(reader, result.BaseUri).ConfigureAwait(false));
break;
case Rss20Constants.GuidTag:
+ {
+ bool isPermalink = true;
+ string permalinkString = reader.GetAttribute(Rss20Constants.IsPermaLinkTag, Rss20Constants.Rss20Namespace);
+ if (permalinkString != null && permalinkString.Equals("false", StringComparison.OrdinalIgnoreCase))
{
- bool isPermalink = true;
- string permalinkString = reader.GetAttribute(Rss20Constants.IsPermaLinkTag, Rss20Constants.Rss20Namespace);
- if (permalinkString != null && permalinkString.Equals("false", StringComparison.OrdinalIgnoreCase))
- {
- isPermalink = false;
- }
- string localName = reader.LocalName;
- string namespaceUri = reader.NamespaceURI;
- result.Id = StringParser(await reader.ReadElementStringAsync(), localName, namespaceUri);
- if (isPermalink)
- {
- fallbackAlternateLink = result.Id;
- }
-
- break;
+ isPermalink = false;
+ }
+ string localName = reader.LocalName;
+ string namespaceUri = reader.NamespaceURI;
+ result.Id = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), localName, namespaceUri);
+ if (isPermalink)
+ {
+ fallbackAlternateLink = result.Id;
}
+ break;
+ }
+
case Rss20Constants.PubDateTag:
+ {
+ bool canReadContent = !reader.IsEmptyElement;
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
+ if (canReadContent)
{
- bool canReadContent = !reader.IsEmptyElement;
- await reader.ReadStartElementAsync();
- if (canReadContent)
+ string str = await reader.ReadStringAsync().ConfigureAwait(false);
+ if (!string.IsNullOrEmpty(str))
{
- string str = await reader.ReadStringAsync();
- if (!string.IsNullOrEmpty(str))
- {
- result.PublishDate = DateTimeParser(str, reader.LocalName, reader.NamespaceURI);
- }
-
- await reader.ReadEndElementAsync();
+ result.PublishDate = DateTimeParser(str, reader.LocalName, reader.NamespaceURI);
}
- break;
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
+ break;
+ }
+
case Rss20Constants.SourceTag:
+ {
+ SyndicationFeed feed = new SyndicationFeed();
+ if (reader.HasAttributes)
{
- SyndicationFeed feed = new SyndicationFeed();
- if (reader.HasAttributes)
+ while (reader.MoveToNextAttribute())
{
- while (reader.MoveToNextAttribute())
+ string ns = reader.NamespaceURI;
+ string name = reader.LocalName;
+ if (FeedUtils.IsXmlns(name, ns))
{
- string ns = reader.NamespaceURI;
- string name = reader.LocalName;
- if (FeedUtils.IsXmlns(name, ns))
- {
- continue;
- }
- string val = await reader.GetValueAsync();
- if (name == Rss20Constants.UrlTag && ns == Rss20Constants.Rss20Namespace)
- {
- feed.Links.Add(SyndicationLink.CreateSelfLink(UriParser(val, UriKind.RelativeOrAbsolute, Rss20Constants.UrlTag, ns)));
- }
- else if (!FeedUtils.IsXmlns(name, ns))
+ continue;
+ }
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
+ if (name == Rss20Constants.UrlTag && ns == Rss20Constants.Rss20Namespace)
+ {
+ feed.Links.Add(SyndicationLink.CreateSelfLink(UriParser(val, UriKind.RelativeOrAbsolute, Rss20Constants.UrlTag, ns)));
+ }
+ else if (!FeedUtils.IsXmlns(name, ns))
+ {
+ if (_preserveAttributeExtensions)
{
- if (_preserveAttributeExtensions)
- {
- feed.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val);
- }
+ feed.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val);
}
}
}
- string localName = reader.LocalName;
- string namespaceUri = reader.NamespaceURI;
- string feedTitle = StringParser(await reader.ReadElementStringAsync(), localName, namespaceUri);
- feed.Title = new TextSyndicationContent(feedTitle);
- result.SourceFeed = feed;
-
- break;
}
+ string localName = reader.LocalName;
+ string namespaceUri = reader.NamespaceURI;
+ string feedTitle = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), localName, namespaceUri);
+ feed.Title = new TextSyndicationContent(feedTitle);
+ result.SourceFeed = feed;
+
+ break;
+ }
default:
notHandled = true;
@@ -382,13 +383,13 @@ namespace System.ServiceModel.Syndication
{
if (_preserveElementExtensions)
{
- var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -400,11 +401,11 @@ namespace System.ServiceModel.Syndication
{
if (extWriter != null)
{
- ((IDisposable)extWriter).Dispose();
+ ((IDisposable) extWriter).Dispose();
}
}
- await reader.ReadEndElementAsync(); // item
+ await reader.ReadEndElementAsync().ConfigureAwait(false); // item
if (!readAlternateLink && fallbackAlternateLink != null)
{
@@ -474,7 +475,7 @@ namespace System.ServiceModel.Syndication
}
SyndicationItem item = CreateItem(feed);
reader = XmlReaderWrapper.CreateFromReader(reader);
- await ReadItemFromAsync(reader, item, feed.BaseUri);
+ await ReadItemFromAsync(reader, item, feed.BaseUri).ConfigureAwait(false);
return item;
}
@@ -492,9 +493,9 @@ namespace System.ServiceModel.Syndication
{
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace);
- await WriteItemContentsAsync(writer, item, feedBaseUri);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
+ await WriteItemContentsAsync(writer, item, feedBaseUri).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
protected virtual async Task WriteItemsAsync(XmlWriter writer, IEnumerable<SyndicationItem> items, Uri feedBaseUri)
@@ -506,7 +507,7 @@ namespace System.ServiceModel.Syndication
foreach (SyndicationItem item in items)
{
- await WriteItemAsync(writer, item, feedBaseUri);
+ await WriteItemAsync(writer, item, feedBaseUri).ConfigureAwait(false);
}
}
@@ -603,13 +604,13 @@ namespace System.ServiceModel.Syndication
private async Task ReadSkipHoursAsync(XmlReader reader, SyndicationFeed result)
{
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
if (reader.LocalName == Rss20Constants.HourTag)
{
- string val = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.HourTag, Rss20Constants.Rss20Namespace);
+ string val = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.HourTag, Rss20Constants.Rss20Namespace);
int hour = int.Parse(val);
bool parsed = false;
parsed = int.TryParse(val, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out hour);
@@ -628,11 +629,11 @@ namespace System.ServiceModel.Syndication
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
@@ -648,13 +649,13 @@ namespace System.ServiceModel.Syndication
private async Task ReadSkipDaysAsync(XmlReader reader, SyndicationFeed result)
{
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
if (reader.LocalName == Rss20Constants.DayTag)
{
- string day = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.DayTag, Rss20Constants.Rss20Namespace);
+ string day = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.DayTag, Rss20Constants.Rss20Namespace);
//Check if the day is actually an accepted day.
if (checkDay(day))
@@ -664,11 +665,11 @@ namespace System.ServiceModel.Syndication
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
internal static void RemoveExtraWhiteSpaceAtStart(StringBuilder stringBuilder)
@@ -745,27 +746,27 @@ namespace System.ServiceModel.Syndication
{
if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
{
- link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync());
+ link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
}
else if (!FeedUtils.IsXmlns(reader.LocalName, reader.NamespaceURI))
{
if (PreserveAttributeExtensions)
{
- link.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync());
+ link.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync().ConfigureAwait(false));
}
}
}
}
string localName = reader.LocalName;
string namespaceUri = reader.NamespaceURI;
- link.Uri = UriParser(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute, localName, namespaceUri);
+ link.Uri = UriParser(await reader.ReadElementStringAsync().ConfigureAwait(false), UriKind.RelativeOrAbsolute, localName, namespaceUri);
return link;
}
private async Task<SyndicationCategory> ReadCategoryAsync(XmlReader reader, SyndicationFeed feed)
{
SyndicationCategory result = CreateCategory(feed);
- await ReadCategoryAsync(reader, result);
+ await ReadCategoryAsync(reader, result).ConfigureAwait(false);
return result;
}
@@ -782,7 +783,7 @@ namespace System.ServiceModel.Syndication
{
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (name == Rss20Constants.DomainTag && ns == Rss20Constants.Rss20Namespace)
{
category.Scheme = val;
@@ -797,19 +798,19 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadStartElementAsync(Rss20Constants.CategoryTag, Rss20Constants.Rss20Namespace);
+ await reader.ReadStartElementAsync(Rss20Constants.CategoryTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
if (!isEmpty)
{
- category.Name = StringParser(await reader.ReadStringAsync(), reader.LocalName, Rss20Constants.Rss20Namespace);
- await reader.ReadEndElementAsync();
+ category.Name = StringParser(await reader.ReadStringAsync().ConfigureAwait(false), reader.LocalName, Rss20Constants.Rss20Namespace);
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
}
private async Task<SyndicationCategory> ReadCategoryAsync(XmlReader reader, SyndicationItem item)
{
SyndicationCategory result = CreateCategory(item);
- await ReadCategoryAsync(reader, result);
+ await ReadCategoryAsync(reader, result).ConfigureAwait(false);
return result;
}
@@ -827,14 +828,14 @@ namespace System.ServiceModel.Syndication
string name = reader.LocalName;
if (name == "base" && ns == Atom10FeedFormatter.XmlNs)
{
- link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync());
+ link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync().ConfigureAwait(false));
continue;
}
if (FeedUtils.IsXmlns(name, ns))
{
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (name == Rss20Constants.UrlTag && ns == Rss20Constants.Rss20Namespace)
{
link.Uri = new Uri(val, UriKind.RelativeOrAbsolute);
@@ -857,11 +858,11 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadStartElementAsync(Rss20Constants.EnclosureTag, Rss20Constants.Rss20Namespace);
+ await reader.ReadStartElementAsync(Rss20Constants.EnclosureTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
if (!isEmptyElement)
{
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
return link;
@@ -870,7 +871,7 @@ namespace System.ServiceModel.Syndication
private async Task<SyndicationPerson> ReadPersonAsync(XmlReader reader, SyndicationFeed feed)
{
SyndicationPerson result = CreatePerson(feed);
- await ReadPersonAsync(reader, result);
+ await ReadPersonAsync(reader, result).ConfigureAwait(false);
return result;
}
@@ -887,7 +888,7 @@ namespace System.ServiceModel.Syndication
{
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, person, Version))
{
if (_preserveAttributeExtensions)
@@ -898,11 +899,11 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
if (!isEmpty)
{
- string email = StringParser(await reader.ReadStringAsync(), reader.LocalName, reader.NamespaceURI);
- await reader.ReadEndElementAsync();
+ string email = StringParser(await reader.ReadStringAsync().ConfigureAwait(false), reader.LocalName, reader.NamespaceURI);
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
person.Email = email;
}
}
@@ -910,7 +911,7 @@ namespace System.ServiceModel.Syndication
private async Task<SyndicationPerson> ReadPersonAsync(XmlReader reader, SyndicationItem item)
{
SyndicationPerson result = CreatePerson(item);
- await ReadPersonAsync(reader, result);
+ await ReadPersonAsync(reader, result).ConfigureAwait(false);
return result;
}
@@ -922,16 +923,16 @@ namespace System.ServiceModel.Syndication
private async Task ReadTextInputTag(XmlReader reader, SyndicationFeed result)
{
- await reader.ReadStartElementAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
SyndicationTextInput textInput = new SyndicationTextInput();
string val = String.Empty;
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
string name = reader.LocalName;
string namespaceUri = reader.NamespaceURI;
- val = StringParser(await reader.ReadElementStringAsync(), name, Rss20Constants.Rss20Namespace);
+ val = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), name, Rss20Constants.Rss20Namespace);
switch (name)
{
@@ -962,13 +963,13 @@ namespace System.ServiceModel.Syndication
result.TextInput = textInput;
}
- await reader.ReadEndElementAsync();
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
private async Task ReadXmlAsync(XmlReader reader, SyndicationFeed result)
{
string baseUri = null;
- await reader.MoveToContentAsync();
+ await reader.MoveToContentAsync().ConfigureAwait(false);
string version = reader.GetAttribute(Rss20Constants.VersionTag, Rss20Constants.Rss20Namespace);
if (version != Rss20Constants.Version)
@@ -985,8 +986,8 @@ namespace System.ServiceModel.Syndication
}
}
- await reader.ReadStartElementAsync();
- await reader.MoveToContentAsync();
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
+ await reader.MoveToContentAsync().ConfigureAwait(false);
if (reader.HasAttributes)
{
@@ -997,7 +998,7 @@ namespace System.ServiceModel.Syndication
if (name == "base" && ns == Atom10FeedFormatter.XmlNs)
{
- baseUri = await reader.GetValueAsync();
+ baseUri = await reader.GetValueAsync().ConfigureAwait(false);
continue;
}
@@ -1006,7 +1007,7 @@ namespace System.ServiceModel.Syndication
continue;
}
- string val = await reader.GetValueAsync();
+ string val = await reader.GetValueAsync().ConfigureAwait(false);
if (!TryParseAttribute(name, ns, val, result, Version))
{
if (_preserveAttributeExtensions)
@@ -1023,7 +1024,7 @@ namespace System.ServiceModel.Syndication
}
bool areAllItemsRead = true;
- await reader.ReadStartElementAsync(Rss20Constants.ChannelTag, Rss20Constants.Rss20Namespace);
+ await reader.ReadStartElementAsync(Rss20Constants.ChannelTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
XmlBuffer buffer = null;
XmlDictionaryWriter extWriter = null;
@@ -1031,105 +1032,105 @@ namespace System.ServiceModel.Syndication
try
{
- while (await reader.IsStartElementAsync())
+ while (await reader.IsStartElementAsync().ConfigureAwait(false))
{
bool notHandled = false;
- if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.NamespaceURI == Rss20Constants.Rss20Namespace)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) == XmlNodeType.Element && reader.NamespaceURI == Rss20Constants.Rss20Namespace)
{
switch (reader.LocalName)
{
case Rss20Constants.TitleTag:
- result.Title = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace));
+ result.Title = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace));
break;
case Rss20Constants.LinkTag:
- result.Links.Add(await ReadAlternateLinkAsync(reader, result.BaseUri));
+ result.Links.Add(await ReadAlternateLinkAsync(reader, result.BaseUri).ConfigureAwait(false));
break;
case Rss20Constants.DescriptionTag:
- result.Description = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace));
+ result.Description = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace));
break;
case Rss20Constants.LanguageTag:
- result.Language = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.LanguageTag, Rss20Constants.Rss20Namespace);
+ result.Language = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.LanguageTag, Rss20Constants.Rss20Namespace);
break;
case Rss20Constants.CopyrightTag:
- result.Copyright = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.CopyrightTag, Rss20Constants.Rss20Namespace));
+ result.Copyright = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.CopyrightTag, Rss20Constants.Rss20Namespace));
break;
case Rss20Constants.ManagingEditorTag:
- result.Authors.Add(await ReadPersonAsync(reader, result));
+ result.Authors.Add(await ReadPersonAsync(reader, result).ConfigureAwait(false));
break;
case Rss20Constants.LastBuildDateTag:
+ {
+ bool canReadContent = !reader.IsEmptyElement;
+ await reader.ReadStartElementAsync().ConfigureAwait(false);
+ if (canReadContent)
{
- bool canReadContent = !reader.IsEmptyElement;
- await reader.ReadStartElementAsync();
- if (canReadContent)
- {
- string str = await reader.ReadStringAsync();
-
- if (!string.IsNullOrEmpty(str))
- {
- result.LastUpdatedTime = DateTimeParser(str, Rss20Constants.LastBuildDateTag, reader.NamespaceURI);
- }
+ string str = await reader.ReadStringAsync().ConfigureAwait(false);
- await reader.ReadEndElementAsync();
+ if (!string.IsNullOrEmpty(str))
+ {
+ result.LastUpdatedTime = DateTimeParser(str, Rss20Constants.LastBuildDateTag, reader.NamespaceURI);
}
- break;
+ await reader.ReadEndElementAsync().ConfigureAwait(false);
}
+ break;
+ }
+
case Rss20Constants.CategoryTag:
- result.Categories.Add(await ReadCategoryAsync(reader, result));
+ result.Categories.Add(await ReadCategoryAsync(reader, result).ConfigureAwait(false));
break;
case Rss20Constants.GeneratorTag:
- result.Generator = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.GeneratorTag, Rss20Constants.Rss20Namespace);
+ result.Generator = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.GeneratorTag, Rss20Constants.Rss20Namespace);
break;
case Rss20Constants.ImageTag:
- {
- await OnReadImage(reader, result);
- break;
- }
+ {
+ await OnReadImage(reader, result).ConfigureAwait(false);
+ break;
+ }
case Rss20Constants.ItemTag:
+ {
+ NullNotAllowedCollection<SyndicationItem> items = new NullNotAllowedCollection<SyndicationItem>();
+ while (await reader.IsStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false))
{
- NullNotAllowedCollection<SyndicationItem> items = new NullNotAllowedCollection<SyndicationItem>();
- while (await reader.IsStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace))
- {
- feedItems.Add(await ReadItemAsync(reader, result));
- }
+ feedItems.Add(await ReadItemAsync(reader, result).ConfigureAwait(false));
+ }
- areAllItemsRead = true;
- break;
- }
+ areAllItemsRead = true;
+ break;
+ }
//Optional tags
case Rss20Constants.DocumentationTag:
- result.Documentation = await ReadAlternateLinkAsync(reader, result.BaseUri);
+ result.Documentation = await ReadAlternateLinkAsync(reader, result.BaseUri).ConfigureAwait(false);
break;
case Rss20Constants.TimeToLiveTag:
- string value = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TimeToLiveTag, Rss20Constants.Rss20Namespace);
+ string value = StringParser(await reader.ReadElementStringAsync().ConfigureAwait(false), Rss20Constants.TimeToLiveTag, Rss20Constants.Rss20Namespace);
int timeToLive = int.Parse(value);
result.TimeToLive = timeToLive;
break;
case Rss20Constants.TextInputTag:
- await ReadTextInputTag(reader, result);
+ await ReadTextInputTag(reader, result).ConfigureAwait(false);
break;
case Rss20Constants.SkipHoursTag:
- await ReadSkipHoursAsync(reader, result);
+ await ReadSkipHoursAsync(reader, result).ConfigureAwait(false);
break;
case Rss20Constants.SkipDaysTag:
- await ReadSkipDaysAsync(reader, result);
+ await ReadSkipDaysAsync(reader, result).ConfigureAwait(false);
break;
default:
@@ -1144,7 +1145,7 @@ namespace System.ServiceModel.Syndication
if (notHandled)
{
- bool parsedExtension = _serializeExtensionsAsAtom && await _atomSerializer.TryParseFeedElementFromAsync(reader, result);
+ bool parsedExtension = _serializeExtensionsAsAtom && await _atomSerializer.TryParseFeedElementFromAsync(reader, result).ConfigureAwait(false);
if (!parsedExtension)
{
@@ -1155,13 +1156,13 @@ namespace System.ServiceModel.Syndication
{
if (_preserveElementExtensions)
{
- var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize);
+ var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize).ConfigureAwait(false);
buffer = tuple.Item1;
extWriter = tuple.Item2;
}
else
{
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
}
}
@@ -1188,27 +1189,27 @@ namespace System.ServiceModel.Syndication
{
if (extWriter != null)
{
- ((IDisposable)extWriter).Dispose();
+ ((IDisposable) extWriter).Dispose();
}
}
if (areAllItemsRead)
{
- await reader.ReadEndElementAsync(); // channel
- await reader.ReadEndElementAsync(); // rss
+ await reader.ReadEndElementAsync().ConfigureAwait(false); // channel
+ await reader.ReadEndElementAsync().ConfigureAwait(false); // rss
}
}
private async Task WriteAlternateLinkAsync(XmlWriter writer, SyndicationLink link, Uri baseUri)
{
- await writer.WriteStartElementAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace);
+ await writer.WriteStartElementAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, link.BaseUri);
if (baseUriToWrite != null)
{
- await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite));
+ await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite)).ConfigureAwait(false);
}
- await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Rss20);
- await writer.WriteStringAsync(FeedUtils.GetUriString(link.Uri));
- await writer.WriteEndElementAsync();
+ await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Rss20).ConfigureAwait(false);
+ await writer.WriteStringAsync(FeedUtils.GetUriString(link.Uri)).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
private async Task WriteCategoryAsync(XmlWriter writer, SyndicationCategory category)
@@ -1217,14 +1218,14 @@ namespace System.ServiceModel.Syndication
{
return;
}
- await writer.WriteStartElementAsync(Rss20Constants.CategoryTag, Rss20Constants.Rss20Namespace);
- await WriteAttributeExtensionsAsync(writer, category, Version);
+ await writer.WriteStartElementAsync(Rss20Constants.CategoryTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
+ await WriteAttributeExtensionsAsync(writer, category, Version).ConfigureAwait(false);
if (!string.IsNullOrEmpty(category.Scheme) && !category.AttributeExtensions.ContainsKey(s_rss20Domain))
{
- await writer.WriteAttributeStringAsync(Rss20Constants.DomainTag, Rss20Constants.Rss20Namespace, category.Scheme);
+ await writer.WriteAttributeStringAsync(Rss20Constants.DomainTag, Rss20Constants.Rss20Namespace, category.Scheme).ConfigureAwait(false);
}
- await writer.WriteStringAsync(category.Name);
- await writer.WriteEndElementAsync();
+ await writer.WriteStringAsync(category.Name).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
private async Task WriteFeedAsync(XmlWriter writer)
@@ -1235,17 +1236,17 @@ namespace System.ServiceModel.Syndication
}
if (_serializeExtensionsAsAtom)
{
- await writer.WriteAttributeStringAsync("xmlns", Atom10Constants.Atom10Prefix, null, Atom10Constants.Atom10Namespace);
+ await writer.WriteAttributeStringAsync("xmlns", Atom10Constants.Atom10Prefix, null, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
}
- await writer.WriteAttributeStringAsync(Rss20Constants.VersionTag, Rss20Constants.Version);
- await writer.WriteStartElementAsync(Rss20Constants.ChannelTag, Rss20Constants.Rss20Namespace);
+ await writer.WriteAttributeStringAsync(Rss20Constants.VersionTag, Rss20Constants.Version).ConfigureAwait(false);
+ await writer.WriteStartElementAsync(Rss20Constants.ChannelTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
if (Feed.BaseUri != null)
{
- await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(Feed.BaseUri));
+ await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(Feed.BaseUri)).ConfigureAwait(false);
}
- await WriteAttributeExtensionsAsync(writer, Feed, Version);
+ await WriteAttributeExtensionsAsync(writer, Feed, Version).ConfigureAwait(false);
string title = Feed.Title != null ? Feed.Title.Text : string.Empty;
- await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace, title);
+ await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace, title).ConfigureAwait(false);
SyndicationLink alternateLink = null;
for (int i = 0; i < Feed.Links.Count; ++i)
@@ -1253,127 +1254,127 @@ namespace System.ServiceModel.Syndication
if (Feed.Links[i].RelationshipType == Atom10Constants.AlternateTag)
{
alternateLink = Feed.Links[i];
- await WriteAlternateLinkAsync(writer, alternateLink, Feed.BaseUri);
+ await WriteAlternateLinkAsync(writer, alternateLink, Feed.BaseUri).ConfigureAwait(false);
break;
}
}
string description = Feed.Description != null ? Feed.Description.Text : string.Empty;
- await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace, description);
+ await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace, description).ConfigureAwait(false);
if (Feed.Language != null)
{
- await writer.WriteElementStringAsync(Rss20Constants.LanguageTag, Feed.Language);
+ await writer.WriteElementStringAsync(Rss20Constants.LanguageTag, Feed.Language).ConfigureAwait(false);
}
if (Feed.Copyright != null)
{
- await writer.WriteElementStringAsync(Rss20Constants.CopyrightTag, Rss20Constants.Rss20Namespace, Feed.Copyright.Text);
+ await writer.WriteElementStringAsync(Rss20Constants.CopyrightTag, Rss20Constants.Rss20Namespace, Feed.Copyright.Text).ConfigureAwait(false);
}
// if there's a single author with an email address, then serialize as the managingEditor
// else serialize the authors as Atom extensions
if ((Feed.Authors.Count == 1) && (Feed.Authors[0].Email != null))
{
- await WritePersonAsync(writer, Rss20Constants.ManagingEditorTag, Feed.Authors[0]);
+ await WritePersonAsync(writer, Rss20Constants.ManagingEditorTag, Feed.Authors[0]).ConfigureAwait(false);
}
else
{
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteFeedAuthorsToAsync(writer, Feed.Authors);
+ await _atomSerializer.WriteFeedAuthorsToAsync(writer, Feed.Authors).ConfigureAwait(false);
}
}
if (Feed.LastUpdatedTime > DateTimeOffset.MinValue)
{
- await writer.WriteStartElementAsync(Rss20Constants.LastBuildDateTag);
- await writer.WriteStringAsync(AsString(Feed.LastUpdatedTime));
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(Rss20Constants.LastBuildDateTag).ConfigureAwait(false);
+ await writer.WriteStringAsync(AsString(Feed.LastUpdatedTime)).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
for (int i = 0; i < Feed.Categories.Count; ++i)
{
- await WriteCategoryAsync(writer, Feed.Categories[i]);
+ await WriteCategoryAsync(writer, Feed.Categories[i]).ConfigureAwait(false);
}
if (!string.IsNullOrEmpty(Feed.Generator))
{
- await writer.WriteElementStringAsync(Rss20Constants.GeneratorTag, Feed.Generator);
+ await writer.WriteElementStringAsync(Rss20Constants.GeneratorTag, Feed.Generator).ConfigureAwait(false);
}
if (Feed.Contributors.Count > 0)
{
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteFeedContributorsToAsync(writer, Feed.Contributors);
+ await _atomSerializer.WriteFeedContributorsToAsync(writer, Feed.Contributors).ConfigureAwait(false);
}
}
if (Feed.ImageUrl != null)
{
- await writer.WriteStartElementAsync(Rss20Constants.ImageTag);
- await writer.WriteElementStringAsync(Rss20Constants.UrlTag, FeedUtils.GetUriString(Feed.ImageUrl));
+ await writer.WriteStartElementAsync(Rss20Constants.ImageTag).ConfigureAwait(false);
+ await writer.WriteElementStringAsync(Rss20Constants.UrlTag, FeedUtils.GetUriString(Feed.ImageUrl)).ConfigureAwait(false);
string imageTitle = Feed.ImageTitle == null ? title : Feed.ImageTitle.Text;
- await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace, imageTitle);
+ await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace, imageTitle).ConfigureAwait(false);
string imgAlternateLink = alternateLink != null ? FeedUtils.GetUriString(alternateLink.Uri) : string.Empty;
string imageLink = Feed.ImageLink == null ? imgAlternateLink : FeedUtils.GetUriString(Feed.ImageLink);
- await writer.WriteElementStringAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace, imageLink);
- await writer.WriteEndElementAsync(); // image
+ await writer.WriteElementStringAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace, imageLink).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false); // image
}
//Optional spec items
//time to live
if (Feed.TimeToLive != 0)
{
- await writer.WriteElementStringAsync(Rss20Constants.TimeToLiveTag, Feed.TimeToLive.ToString());
+ await writer.WriteElementStringAsync(Rss20Constants.TimeToLiveTag, Feed.TimeToLive.ToString()).ConfigureAwait(false);
}
//skiphours
if (Feed.SkipHours.Count > 0)
{
- await writer.WriteStartElementAsync(Rss20Constants.SkipHoursTag);
+ await writer.WriteStartElementAsync(Rss20Constants.SkipHoursTag).ConfigureAwait(false);
foreach (int hour in Feed.SkipHours)
{
writer.WriteElementString(Rss20Constants.HourTag, hour.ToString());
}
- await writer.WriteEndElementAsync();
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
//skipDays
if (Feed.SkipDays.Count > 0)
{
- await writer.WriteStartElementAsync(Rss20Constants.SkipDaysTag);
+ await writer.WriteStartElementAsync(Rss20Constants.SkipDaysTag).ConfigureAwait(false);
- foreach(string day in Feed.SkipDays)
+ foreach (string day in Feed.SkipDays)
{
- await writer.WriteElementStringAsync(Rss20Constants.DayTag, day);
+ await writer.WriteElementStringAsync(Rss20Constants.DayTag, day).ConfigureAwait(false);
}
- await writer.WriteEndElementAsync();
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
//textinput
if (Feed.TextInput != null)
{
- await writer.WriteStartElementAsync(Rss20Constants.TextInputTag);
+ await writer.WriteStartElementAsync(Rss20Constants.TextInputTag).ConfigureAwait(false);
- await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Feed.TextInput.Description);
- await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Feed.TextInput.title);
- await writer.WriteElementStringAsync(Rss20Constants.LinkTag, Feed.TextInput.link.GetAbsoluteUri().ToString());
- await writer.WriteElementStringAsync(Rss20Constants.NameTag, Feed.TextInput.name);
+ await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Feed.TextInput.Description).ConfigureAwait(false);
+ await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Feed.TextInput.title).ConfigureAwait(false);
+ await writer.WriteElementStringAsync(Rss20Constants.LinkTag, Feed.TextInput.link.GetAbsoluteUri().ToString()).ConfigureAwait(false);
+ await writer.WriteElementStringAsync(Rss20Constants.NameTag, Feed.TextInput.name).ConfigureAwait(false);
- await writer.WriteEndElementAsync();
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteElementAsync(writer, Atom10Constants.IdTag, Feed.Id);
+ await _atomSerializer.WriteElementAsync(writer, Atom10Constants.IdTag, Feed.Id).ConfigureAwait(false);
// dont write out the 1st alternate link since that would have been written out anyway
bool isFirstAlternateLink = true;
@@ -1384,13 +1385,13 @@ namespace System.ServiceModel.Syndication
isFirstAlternateLink = false;
continue;
}
- await _atomSerializer.WriteLinkAsync(writer, Feed.Links[i], Feed.BaseUri);
+ await _atomSerializer.WriteLinkAsync(writer, Feed.Links[i], Feed.BaseUri).ConfigureAwait(false);
}
}
- await WriteElementExtensionsAsync(writer, Feed, Version);
- await WriteItemsAsync(writer, Feed.Items, Feed.BaseUri);
- await writer.WriteEndElementAsync(); // channel
+ await WriteElementExtensionsAsync(writer, Feed, Version).ConfigureAwait(false);
+ await WriteItemsAsync(writer, Feed.Items, Feed.BaseUri).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false); // channel
}
private async Task WriteItemContentsAsync(XmlWriter writer, SyndicationItem item, Uri feedBaseUri)
@@ -1398,9 +1399,9 @@ namespace System.ServiceModel.Syndication
Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(feedBaseUri, item.BaseUri);
if (baseUriToWrite != null)
{
- await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite));
+ await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite)).ConfigureAwait(false);
}
- await WriteAttributeExtensionsAsync(writer, item, Version);
+ await WriteAttributeExtensionsAsync(writer, item, Version).ConfigureAwait(false);
string guid = item.Id ?? string.Empty;
bool isPermalink = false;
SyndicationLink firstAlternateLink = null;
@@ -1422,45 +1423,45 @@ namespace System.ServiceModel.Syndication
if (!string.IsNullOrEmpty(guid))
{
- await writer.WriteStartElementAsync(Rss20Constants.GuidTag);
+ await writer.WriteStartElementAsync(Rss20Constants.GuidTag).ConfigureAwait(false);
if (isPermalink)
{
- await writer.WriteAttributeStringAsync(Rss20Constants.IsPermaLinkTag, "true");
+ await writer.WriteAttributeStringAsync(Rss20Constants.IsPermaLinkTag, "true").ConfigureAwait(false);
}
else
{
- await writer.WriteAttributeStringAsync(Rss20Constants.IsPermaLinkTag, "false");
+ await writer.WriteAttributeStringAsync(Rss20Constants.IsPermaLinkTag, "false").ConfigureAwait(false);
}
- await writer.WriteStringAsync(guid);
- await writer.WriteEndElementAsync();
+ await writer.WriteStringAsync(guid).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
if (firstAlternateLink != null)
{
- await WriteAlternateLinkAsync(writer, firstAlternateLink, (item.BaseUri != null ? item.BaseUri : feedBaseUri));
+ await WriteAlternateLinkAsync(writer, firstAlternateLink, (item.BaseUri != null ? item.BaseUri : feedBaseUri)).ConfigureAwait(false);
}
if (item.Authors.Count == 1 && !string.IsNullOrEmpty(item.Authors[0].Email))
{
- await WritePersonAsync(writer, Rss20Constants.AuthorTag, item.Authors[0]);
+ await WritePersonAsync(writer, Rss20Constants.AuthorTag, item.Authors[0]).ConfigureAwait(false);
}
else
{
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteItemAuthorsToAsync(writer, item.Authors);
+ await _atomSerializer.WriteItemAuthorsToAsync(writer, item.Authors).ConfigureAwait(false);
}
}
for (int i = 0; i < item.Categories.Count; ++i)
{
- await WriteCategoryAsync(writer, item.Categories[i]);
+ await WriteCategoryAsync(writer, item.Categories[i]).ConfigureAwait(false);
}
bool serializedTitle = false;
if (item.Title != null)
{
- await writer.WriteElementStringAsync(Rss20Constants.TitleTag, item.Title.Text);
+ await writer.WriteElementStringAsync(Rss20Constants.TitleTag, item.Title.Text).ConfigureAwait(false);
serializedTitle = true;
}
@@ -1480,13 +1481,13 @@ namespace System.ServiceModel.Syndication
if (summary != null)
{
- await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace, summary.Text);
+ await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace, summary.Text).ConfigureAwait(false);
}
if (item.SourceFeed != null)
{
- await writer.WriteStartElementAsync(Rss20Constants.SourceTag, Rss20Constants.Rss20Namespace);
- await WriteAttributeExtensionsAsync(writer, item.SourceFeed, Version);
+ await writer.WriteStartElementAsync(Rss20Constants.SourceTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
+ await WriteAttributeExtensionsAsync(writer, item.SourceFeed, Version).ConfigureAwait(false);
SyndicationLink selfLink = null;
for (int i = 0; i < item.SourceFeed.Links.Count; ++i)
{
@@ -1498,16 +1499,16 @@ namespace System.ServiceModel.Syndication
}
if (selfLink != null && !item.SourceFeed.AttributeExtensions.ContainsKey(s_rss20Url))
{
- await writer.WriteAttributeStringAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace, FeedUtils.GetUriString(selfLink.Uri));
+ await writer.WriteAttributeStringAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace, FeedUtils.GetUriString(selfLink.Uri)).ConfigureAwait(false);
}
string title = (item.SourceFeed.Title != null) ? item.SourceFeed.Title.Text : string.Empty;
- await writer.WriteStringAsync(title);
- await writer.WriteEndElementAsync();
+ await writer.WriteStringAsync(title).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
if (item.PublishDate > DateTimeOffset.MinValue)
{
- await writer.WriteElementStringAsync(Rss20Constants.PubDateTag, Rss20Constants.Rss20Namespace, AsString(item.PublishDate));
+ await writer.WriteElementStringAsync(Rss20Constants.PubDateTag, Rss20Constants.Rss20Namespace, AsString(item.PublishDate)).ConfigureAwait(false);
}
// serialize the enclosures
@@ -1521,7 +1522,7 @@ namespace System.ServiceModel.Syndication
if (firstEnclosureLink == null)
{
firstEnclosureLink = item.Links[i];
- await WriteMediaEnclosureAsync(writer, item.Links[i], item.BaseUri);
+ await WriteMediaEnclosureAsync(writer, item.Links[i], item.BaseUri).ConfigureAwait(false);
continue;
}
}
@@ -1536,7 +1537,7 @@ namespace System.ServiceModel.Syndication
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteLinkAsync(writer, item.Links[i], item.BaseUri);
+ await _atomSerializer.WriteLinkAsync(writer, item.Links[i], item.BaseUri).ConfigureAwait(false);
}
}
@@ -1544,20 +1545,20 @@ namespace System.ServiceModel.Syndication
{
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteItemLastUpdatedTimeToAsync(writer, item.LastUpdatedTime);
+ await _atomSerializer.WriteItemLastUpdatedTimeToAsync(writer, item.LastUpdatedTime).ConfigureAwait(false);
}
}
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteContentToAsync(writer, Atom10Constants.RightsTag, item.Copyright);
+ await _atomSerializer.WriteContentToAsync(writer, Atom10Constants.RightsTag, item.Copyright).ConfigureAwait(false);
}
if (!serializedContentAsDescription)
{
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteContentToAsync(writer, Atom10Constants.ContentTag, item.Content);
+ await _atomSerializer.WriteContentToAsync(writer, Atom10Constants.ContentTag, item.Content).ConfigureAwait(false);
}
}
@@ -1565,47 +1566,47 @@ namespace System.ServiceModel.Syndication
{
if (_serializeExtensionsAsAtom)
{
- await _atomSerializer.WriteItemContributorsToAsync(writer, item.Contributors);
+ await _atomSerializer.WriteItemContributorsToAsync(writer, item.Contributors).ConfigureAwait(false);
}
}
- await WriteElementExtensionsAsync(writer, item, Version);
+ await WriteElementExtensionsAsync(writer, item, Version).ConfigureAwait(false);
}
private async Task WriteMediaEnclosureAsync(XmlWriter writer, SyndicationLink link, Uri baseUri)
{
- await writer.WriteStartElementAsync(Rss20Constants.EnclosureTag, Rss20Constants.Rss20Namespace);
+ await writer.WriteStartElementAsync(Rss20Constants.EnclosureTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, link.BaseUri);
if (baseUriToWrite != null)
{
- await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite));
+ await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite)).ConfigureAwait(false);
}
- await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Rss20);
+ await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Rss20).ConfigureAwait(false);
if (!link.AttributeExtensions.ContainsKey(s_rss20Url))
{
- await writer.WriteAttributeStringAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace, FeedUtils.GetUriString(link.Uri));
+ await writer.WriteAttributeStringAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace, FeedUtils.GetUriString(link.Uri)).ConfigureAwait(false);
}
if (link.MediaType != null && !link.AttributeExtensions.ContainsKey(s_rss20Type))
{
- await writer.WriteAttributeStringAsync(Rss20Constants.TypeTag, Rss20Constants.Rss20Namespace, link.MediaType);
+ await writer.WriteAttributeStringAsync(Rss20Constants.TypeTag, Rss20Constants.Rss20Namespace, link.MediaType).ConfigureAwait(false);
}
if (link.Length != 0 && !link.AttributeExtensions.ContainsKey(s_rss20Length))
{
- await writer.WriteAttributeStringAsync(Rss20Constants.LengthTag, Rss20Constants.Rss20Namespace, Convert.ToString(link.Length, CultureInfo.InvariantCulture));
+ await writer.WriteAttributeStringAsync(Rss20Constants.LengthTag, Rss20Constants.Rss20Namespace, Convert.ToString(link.Length, CultureInfo.InvariantCulture)).ConfigureAwait(false);
}
- await writer.WriteEndElementAsync();
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
private async Task WritePersonAsync(XmlWriter writer, string elementTag, SyndicationPerson person)
{
- await writer.WriteStartElementAsync(elementTag, Rss20Constants.Rss20Namespace);
- await WriteAttributeExtensionsAsync(writer, person, Version);
- await writer.WriteStringAsync(person.Email);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(elementTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
+ await WriteAttributeExtensionsAsync(writer, person, Version).ConfigureAwait(false);
+ await writer.WriteStringAsync(person.Email).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs
index bcac86571d..513563712c 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
@@ -166,9 +165,9 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace);
- await WriteItem(writer);
- await writer.WriteEndElementAsync();
+ await writer.WriteStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace).ConfigureAwait(false);
+ await WriteItem(writer).ConfigureAwait(false);
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
protected override SyndicationItem CreateItemInstance()
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs
index 530d480d1c..545f9f5908 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs
@@ -7,7 +7,6 @@ namespace System.ServiceModel.Syndication
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
@@ -83,7 +82,7 @@ namespace System.ServiceModel.Syndication
where TServiceDocument : ServiceDocument, new()
{
AtomPub10ServiceDocumentFormatter<TServiceDocument> formatter = new AtomPub10ServiceDocumentFormatter<TServiceDocument>();
- await formatter.ReadFromAsync(reader);
+ await formatter.ReadFromAsync(reader).ConfigureAwait(false);
return (TServiceDocument)(object)formatter.Document;
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs
index ebe1cea6a7..4595346232 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Xml;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs
index 7ad714b3e3..6a38e17a4c 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Syndication
{
using System;
using System.Collections.Generic;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs
index c3a9d4a521..dc1db98aee 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Syndication
{
using System;
using System.Collections.Generic;
- using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Xml;
@@ -102,8 +101,8 @@ namespace System.ServiceModel.Syndication
writer = XmlWriterWrapper.CreateFromWriter(writer);
- await writer.WriteStartElementAsync(outerElementName, outerElementNamespace);
- await writer.WriteAttributeStringAsync(Atom10Constants.TypeTag, string.Empty, Type);
+ await writer.WriteStartElementAsync(outerElementName, outerElementNamespace).ConfigureAwait(false);
+ await writer.WriteAttributeStringAsync(Atom10Constants.TypeTag, string.Empty, Type).ConfigureAwait(false);
if (_attributeExtensions != null)
{
foreach (XmlQualifiedName key in _attributeExtensions.Keys)
@@ -115,12 +114,12 @@ namespace System.ServiceModel.Syndication
string attrValue;
if (_attributeExtensions.TryGetValue(key, out attrValue))
{
- await writer.WriteAttributeStringAsync(key.Name, key.Namespace, attrValue);
+ await writer.WriteAttributeStringAsync(key.Name, key.Namespace, attrValue).ConfigureAwait(false);
}
}
}
WriteContentsTo(writer);
- await writer.WriteEndElementAsync();
+ await writer.WriteEndElementAsync().ConfigureAwait(false);
}
internal void CopyAttributeExtensions(SyndicationContent source)
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs
index c6a60dae4a..5916466f20 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs
@@ -7,7 +7,6 @@ namespace System.ServiceModel.Syndication
using System;
using System.Diagnostics;
using System.IO;
- using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Xml;
@@ -166,9 +165,9 @@ namespace System.ServiceModel.Syndication
return (TExtension)_extensionData;
}
- using (XmlReader reader = await GetReaderAsync())
+ using (XmlReader reader = await GetReaderAsync().ConfigureAwait(false))
{
- return (TExtension)serializer.ReadObject(reader, false);
+ return (TExtension) serializer.ReadObject(reader, false);
}
}
@@ -178,20 +177,20 @@ namespace System.ServiceModel.Syndication
{
throw new ArgumentNullException(nameof(serializer));
}
- if (_extensionData != null && typeof(TExtension).IsAssignableFrom(_extensionData.GetType()))
+ if (_extensionData != null && typeof (TExtension).IsAssignableFrom(_extensionData.GetType()))
{
- return (TExtension)_extensionData;
+ return (TExtension) _extensionData;
}
- using (XmlReader reader = await GetReaderAsync())
+ using (XmlReader reader = await GetReaderAsync().ConfigureAwait(false))
{
- return (TExtension)serializer.Deserialize(reader);
+ return (TExtension) serializer.Deserialize(reader);
}
}
public async Task<XmlReader> GetReaderAsync()
{
- await EnsureBufferAsync();
+ await EnsureBufferAsync().ConfigureAwait(false);
XmlReader reader = XmlReaderWrapper.CreateFromReader(_buffer.GetReader(0));
int index = 0;
reader.ReadStartElement(Rss20Constants.ExtensionWrapperTag);
@@ -203,7 +202,7 @@ namespace System.ServiceModel.Syndication
}
++index;
- await reader.SkipAsync();
+ await reader.SkipAsync().ConfigureAwait(false);
}
return reader;
@@ -222,9 +221,9 @@ namespace System.ServiceModel.Syndication
else
{
writer = XmlWriterWrapper.CreateFromWriter(writer);
- using (XmlReader reader = await GetReaderAsync())
+ using (XmlReader reader = await GetReaderAsync().ConfigureAwait(false))
{
- await writer.WriteNodeAsync(reader, false);
+ await writer.WriteNodeAsync(reader, false).ConfigureAwait(false);
}
}
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs
index ab44ac33f8..b5f10ecf17 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs
@@ -7,7 +7,6 @@ namespace System.ServiceModel.Syndication
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
- using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Xml;
@@ -125,7 +124,7 @@ namespace System.ServiceModel.Syndication
public async Task<XmlReader> GetReaderAtElementExtensionsAsync()
{
- XmlBuffer extensionsBuffer = await GetOrCreateBufferOverExtensions();
+ XmlBuffer extensionsBuffer = await GetOrCreateBufferOverExtensions().ConfigureAwait(false);
XmlReader reader = extensionsBuffer.GetReader(0);
reader.ReadStartElement();
return reader;
@@ -133,7 +132,7 @@ namespace System.ServiceModel.Syndication
public Task<Collection<TExtension>> ReadElementExtensionsAsync<TExtension>(string extensionName, string extensionNamespace)
{
- return ReadElementExtensionsAsync<TExtension>(extensionName, extensionNamespace, new DataContractSerializer(typeof(TExtension)));
+ return ReadElementExtensionsAsync<TExtension>(extensionName, extensionNamespace, new DataContractSerializer(typeof (TExtension)));
}
public Task<Collection<TExtension>> ReadElementExtensionsAsync<TExtension>(string extensionName, string extensionNamespace, XmlObjectSerializer serializer)
@@ -163,7 +162,7 @@ namespace System.ServiceModel.Syndication
reader.ReadStartElement();
while (reader.IsStartElement())
{
- await writer.WriteNodeAsync(reader, false);
+ await writer.WriteNodeAsync(reader, false).ConfigureAwait(false);
}
}
}
@@ -171,7 +170,7 @@ namespace System.ServiceModel.Syndication
{
for (int i = 0; i < Items.Count; ++i)
{
- await Items[i].WriteToAsync(writer);
+ await Items[i].WriteToAsync(writer).ConfigureAwait(false);
}
}
}
@@ -236,7 +235,7 @@ namespace System.ServiceModel.Syndication
writer.WriteStartElement(Rss20Constants.ExtensionWrapperTag);
for (int i = 0; i < Count; ++i)
{
- await this[i].WriteToAsync(writer);
+ await this[i].WriteToAsync(writer).ConfigureAwait(false);
}
writer.WriteEndElement();
}
@@ -284,11 +283,11 @@ namespace System.ServiceModel.Syndication
if (dcSerializer != null)
{
- results.Add(await this[i].GetObjectAsync<TExtension>(dcSerializer));
+ results.Add(await this[i].GetObjectAsync<TExtension>(dcSerializer).ConfigureAwait(false));
}
else
{
- results.Add(await this[i].GetObjectAsync<TExtension>(xmlSerializer));
+ results.Add(await this[i].GetObjectAsync<TExtension>(xmlSerializer).ConfigureAwait(false));
}
}
return results;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs
index 4b53d1b3ff..aa44cf8753 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs
@@ -8,7 +8,6 @@ namespace System.ServiceModel.Syndication
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
@@ -351,12 +350,12 @@ namespace System.ServiceModel.Syndication
//// Custom Parsing
public static async Task<SyndicationFeed> LoadAsync(XmlReader reader, Rss20FeedFormatter formatter, CancellationToken ct)
{
- return await LoadAsync(reader, formatter, new Atom10FeedFormatter(), ct);
+ return await LoadAsync(reader, formatter, new Atom10FeedFormatter(), ct).ConfigureAwait(false);
}
public static async Task<SyndicationFeed> LoadAsync(XmlReader reader, Atom10FeedFormatter formatter, CancellationToken ct)
{
- return await LoadAsync(reader, new Rss20FeedFormatter(), formatter, ct);
+ return await LoadAsync(reader, new Rss20FeedFormatter(), formatter, ct).ConfigureAwait(false);
}
public static async Task<SyndicationFeed> LoadAsync(XmlReader reader, Rss20FeedFormatter Rssformatter, Atom10FeedFormatter Atomformatter, CancellationToken ct)
@@ -371,13 +370,13 @@ namespace System.ServiceModel.Syndication
Atom10FeedFormatter atomSerializer = Atomformatter;
if (atomSerializer.CanRead(reader))
{
- await atomSerializer.ReadFromAsync(reader, new CancellationToken());
+ await atomSerializer.ReadFromAsync(reader, new CancellationToken()).ConfigureAwait(false);
return atomSerializer.Feed;
}
Rss20FeedFormatter rssSerializer = Rssformatter;
if (rssSerializer.CanRead(reader))
{
- await rssSerializer.ReadFromAsync(reader, new CancellationToken());
+ await rssSerializer.ReadFromAsync(reader, new CancellationToken()).ConfigureAwait(false);
return rssSerializer.Feed;
}
throw new XmlException(SR.Format(SR.UnknownFeedXml, reader.LocalName, reader.NamespaceURI));
@@ -390,8 +389,7 @@ namespace System.ServiceModel.Syndication
return Load<SyndicationFeed>(reader);
}
- public static TSyndicationFeed Load<TSyndicationFeed>(XmlReader reader)
- where TSyndicationFeed : SyndicationFeed, new()
+ public static TSyndicationFeed Load<TSyndicationFeed>(XmlReader reader) where TSyndicationFeed : SyndicationFeed, new()
{
CancellationToken ct = new CancellationToken();
return LoadAsync<TSyndicationFeed>(reader, ct).GetAwaiter().GetResult();
@@ -399,23 +397,22 @@ namespace System.ServiceModel.Syndication
public static async Task<SyndicationFeed> LoadAsync(XmlReader reader, CancellationToken ct)
{
- return await LoadAsync<SyndicationFeed>(reader, ct);
+ return await LoadAsync<SyndicationFeed>(reader, ct).ConfigureAwait(false);
}
- public static async Task<TSyndicationFeed> LoadAsync<TSyndicationFeed>(XmlReader reader, CancellationToken ct)
- where TSyndicationFeed : SyndicationFeed, new()
+ public static async Task<TSyndicationFeed> LoadAsync<TSyndicationFeed>(XmlReader reader, CancellationToken ct) where TSyndicationFeed : SyndicationFeed, new()
{
Atom10FeedFormatter<TSyndicationFeed> atomSerializer = new Atom10FeedFormatter<TSyndicationFeed>();
if (atomSerializer.CanRead(reader))
{
- await atomSerializer.ReadFromAsync(reader, ct);
+ await atomSerializer.ReadFromAsync(reader, ct).ConfigureAwait(false);
return atomSerializer.Feed as TSyndicationFeed;
}
Rss20FeedFormatter<TSyndicationFeed> rssSerializer = new Rss20FeedFormatter<TSyndicationFeed>();
if (rssSerializer.CanRead(reader))
{
- await rssSerializer.ReadFromAsync(reader, ct);
+ await rssSerializer.ReadFromAsync(reader, ct).ConfigureAwait(false);
return rssSerializer.Feed as TSyndicationFeed;
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs
index 5645a02936..68b6cbd89f 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs
@@ -392,10 +392,10 @@ namespace System.ServiceModel.Syndication
{
throw new ArgumentNullException(nameof(feed));
}
- await feed.WriteAttributeExtensionsAsync(writer, version);
+ await feed.WriteAttributeExtensionsAsync(writer, version).ConfigureAwait(false);
}
- internal static protected Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationItem item, string version)
+ protected internal static Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationItem item, string version)
{
if (item == null)
{
@@ -404,7 +404,7 @@ namespace System.ServiceModel.Syndication
return item.WriteAttributeExtensionsAsync(writer, version);
}
- internal static protected Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version)
+ protected internal static Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version)
{
if (category == null)
{
@@ -413,7 +413,7 @@ namespace System.ServiceModel.Syndication
return category.WriteAttributeExtensionsAsync(writer, version);
}
- internal static protected Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationLink link, string version)
+ protected internal static Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationLink link, string version)
{
if (link == null)
{
@@ -422,7 +422,7 @@ namespace System.ServiceModel.Syndication
return link.WriteAttributeExtensionsAsync(writer, version);
}
- internal static protected Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version)
+ protected internal static Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version)
{
if (person == null)
{
@@ -431,7 +431,7 @@ namespace System.ServiceModel.Syndication
return person.WriteAttributeExtensionsAsync(writer, version);
}
- internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationFeed feed, string version)
+ protected internal static Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationFeed feed, string version)
{
if (feed == null)
{
@@ -440,7 +440,7 @@ namespace System.ServiceModel.Syndication
return feed.WriteElementExtensionsAsync(writer, version);
}
- internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationItem item, string version)
+ protected internal static Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationItem item, string version)
{
if (item == null)
{
@@ -449,7 +449,7 @@ namespace System.ServiceModel.Syndication
return item.WriteElementExtensionsAsync(writer, version);
}
- internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version)
+ protected internal static Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version)
{
if (category == null)
{
@@ -458,7 +458,7 @@ namespace System.ServiceModel.Syndication
return category.WriteElementExtensionsAsync(writer, version);
}
- internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationLink link, string version)
+ protected internal static Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationLink link, string version)
{
if (link == null)
{
@@ -467,7 +467,7 @@ namespace System.ServiceModel.Syndication
return link.WriteElementExtensionsAsync(writer, version);
}
- internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version)
+ protected internal static Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version)
{
if (person == null)
{
@@ -477,9 +477,10 @@ namespace System.ServiceModel.Syndication
return person.WriteElementExtensionsAsync(writer, version);
}
- internal protected virtual void SetFeed(SyndicationFeed feed)
+ protected internal virtual void SetFeed(SyndicationFeed feed)
{
- _feed = feed ?? throw new ArgumentNullException(nameof(feed));
+ _feed = feed ??
+ throw new ArgumentNullException(nameof(feed));
}
private static string DefaultStringParser(string value, string localName, string ns)
@@ -522,7 +523,7 @@ namespace System.ServiceModel.Syndication
}
else
{
- await extWriter.InternalWriteNodeAsync(reader, false);
+ await extWriter.InternalWriteNodeAsync(reader, false).ConfigureAwait(false);
}
return Tuple.Create(buffer, extWriter);
@@ -530,13 +531,13 @@ namespace System.ServiceModel.Syndication
internal static SyndicationFeed CreateFeedInstance(Type feedType)
{
- if (feedType.Equals(typeof(SyndicationFeed)))
+ if (feedType.Equals(typeof (SyndicationFeed)))
{
return new SyndicationFeed();
}
else
{
- return (SyndicationFeed)Activator.CreateInstance(feedType);
+ return (SyndicationFeed) Activator.CreateInstance(feedType);
}
}
@@ -596,7 +597,7 @@ namespace System.ServiceModel.Syndication
internal static async Task MoveToStartElementAsync(XmlReader reader)
{
- if (!await reader.IsStartElementAsync())
+ if (!await reader.IsStartElementAsync().ConfigureAwait(false))
{
XmlExceptionHelper.ThrowStartElementExpected(XmlDictionaryReader.CreateDictionaryReader(reader));
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs
index e68efb88d8..2013403aa6 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs
@@ -231,7 +231,7 @@ namespace System.ServiceModel.Syndication
Rss20ItemFormatter<TSyndicationItem> rssSerializer = new Rss20ItemFormatter<TSyndicationItem>();
if (rssSerializer.CanRead(reader))
{
- await rssSerializer.ReadFromAsync(reader);
+ await rssSerializer.ReadFromAsync(reader).ConfigureAwait(false);
return rssSerializer.Item as TSyndicationItem;
}
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs
index 739372a848..75aa5a00b2 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Syndication
{
using System;
using System.Globalization;
- using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Xml;
@@ -227,27 +226,27 @@ namespace System.ServiceModel.Syndication
protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationItem item, string version)
{
- await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, item, version);
+ await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, item, version).ConfigureAwait(false);
}
protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version)
{
- await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, category, version);
+ await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, category, version).ConfigureAwait(false);
}
protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationLink link, string version)
{
- await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, link, version);
+ await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, link, version).ConfigureAwait(false);
}
protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version)
{
- await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, person, version);
+ await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, person, version).ConfigureAwait(false);
}
protected static async Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationItem item, string version)
{
- await SyndicationFeedFormatter.WriteElementExtensionsAsync(writer, item, version);
+ await SyndicationFeedFormatter.WriteElementExtensionsAsync(writer, item, version).ConfigureAwait(false);
}
protected abstract SyndicationItem CreateItemInstance();
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs
index 3bd3bae2f4..cf99a41849 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Syndication
{
using System;
using System.Collections.Generic;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs
index a10b79b285..8f7b048fdb 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Syndication
{
using System;
using System.Collections.Generic;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs
index cca8ac3133..1faed0d48c 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs
@@ -4,8 +4,6 @@
namespace System.ServiceModel.Syndication
{
- using System.Runtime.CompilerServices;
-
public static class SyndicationVersions
{
public const string Atom10 = "Atom10";
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs
index 7953f66636..9cbf8e0854 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Xml;
// NOTE: This class implements Clone so if you add any members, please update the copy ctor
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs
index 1dda2a2e36..29ee361bca 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs
@@ -4,8 +4,6 @@
namespace System.ServiceModel.Syndication
{
- using System.Runtime.CompilerServices;
-
public enum TextSyndicationContentKind
{
Plaintext,
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs
index 86bce8777f..8de28c75e5 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs
@@ -5,7 +5,6 @@
namespace System.ServiceModel.Syndication
{
using System;
- using System.Runtime.CompilerServices;
using System.Xml;
// NOTE: This class implements Clone so if you add any members, please update the copy ctor
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs
index 586ad20f7b..5c56e5e901 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs
@@ -7,7 +7,6 @@ namespace System.ServiceModel.Syndication
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs
index f78889c9d4..277e14d30b 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs
@@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Xml;
@@ -102,37 +101,37 @@ namespace System.ServiceModel.Syndication
public static async Task ReadStartElementAsync(this XmlReader reader)
{
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
public static async Task<string> ReadElementStringAsync(this XmlReader reader)
{
string result = string.Empty;
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
if (!reader.IsEmptyElement)
{
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
result = reader.ReadString();
if (reader.NodeType != XmlNodeType.EndElement)
{
throw CreateXmlException(SR.Format(SR.Xml_UnexpectedNodeInSimpleContent, reader.NodeType.ToString(), nameof(ReadElementStringAsync)), reader);
}
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
else
{
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
return result;
@@ -151,7 +150,7 @@ namespace System.ServiceModel.Syndication
{
return string.Empty;
}
- else if (!await reader.ReadAsync())
+ else if (!await reader.ReadAsync().ConfigureAwait(false))
{
throw new InvalidOperationException(SR.Xml_InvalidOperation);
}
@@ -165,8 +164,8 @@ namespace System.ServiceModel.Syndication
string result = string.Empty;
while (IsTextualNode(reader.NodeType))
{
- result += await reader.GetValueAsync();
- if (!await reader.ReadAsync())
+ result += await reader.GetValueAsync().ConfigureAwait(false);
+ if (!await reader.ReadAsync().ConfigureAwait(false))
{
break;
}
@@ -175,53 +174,53 @@ namespace System.ServiceModel.Syndication
return result;
}
- static internal bool IsTextualNode(XmlNodeType nodeType)
+ internal static bool IsTextualNode(XmlNodeType nodeType)
{
#if DEBUG
// This code verifies IsTextualNodeBitmap mapping of XmlNodeType to a bool specifying
// whether the node is 'textual' = Text, CDATA, Whitespace or SignificantWhitespace.
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.None)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Element)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Attribute)));
- Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Text)));
- Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.CDATA)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.EntityReference)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Entity)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.ProcessingInstruction)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Comment)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Document)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentType)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentFragment)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Notation)));
- Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Whitespace)));
- Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.SignificantWhitespace)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.EndElement)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.EndEntity)));
- Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.XmlDeclaration)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.None)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Element)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Attribute)));
+ Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Text)));
+ Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int) XmlNodeType.CDATA)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.EntityReference)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Entity)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.ProcessingInstruction)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Comment)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Document)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.DocumentType)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.DocumentFragment)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Notation)));
+ Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int) XmlNodeType.Whitespace)));
+ Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int) XmlNodeType.SignificantWhitespace)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.EndElement)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.EndEntity)));
+ Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int) XmlNodeType.XmlDeclaration)));
#endif
- return 0 != (IsTextualNodeBitmap & (1 << (int)nodeType));
+ return 0 != (IsTextualNodeBitmap & (1 << (int) nodeType));
}
public static async Task ReadEndElementAsync(this XmlReader reader)
{
- if (await reader.MoveToContentAsync() != XmlNodeType.EndElement)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.EndElement)
{
throw new XmlException(reader.NodeType.ToString() + " is an invalid XmlNodeType");
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
public static async Task ReadStartElementAsync(this XmlReader reader, string localname, string ns)
{
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
if (reader.LocalName == localname && reader.NamespaceURI == ns)
{
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
else
{
@@ -232,23 +231,23 @@ namespace System.ServiceModel.Syndication
public static async Task<bool> IsStartElementAsync(this XmlReader reader)
{
- return await reader.MoveToContentAsync() == XmlNodeType.Element;
+ return await reader.MoveToContentAsync().ConfigureAwait(false) == XmlNodeType.Element;
}
public static async Task<bool> IsStartElementAsync(this XmlReader reader, string localname, string ns)
{
- return (await reader.MoveToContentAsync() == XmlNodeType.Element) && (reader.LocalName == localname && reader.NamespaceURI == ns);
+ return (await reader.MoveToContentAsync().ConfigureAwait(false) == XmlNodeType.Element) && (reader.LocalName == localname && reader.NamespaceURI == ns);
}
private static async Task ReadStartElementAsync(this XmlReader reader, string name)
{
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
if (reader.Name == name)
{
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
else
{
@@ -258,14 +257,14 @@ namespace System.ServiceModel.Syndication
private static async Task<bool> IsStartElementAsync(this XmlReader reader, string name)
{
- return await reader.MoveToContentAsync() == XmlNodeType.Element && reader.Name == name;
+ return await reader.MoveToContentAsync().ConfigureAwait(false) == XmlNodeType.Element && reader.Name == name;
}
private static async Task<string> ReadElementStringAsync(this XmlReader reader, string name)
{
string result = string.Empty;
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
@@ -277,17 +276,17 @@ namespace System.ServiceModel.Syndication
if (!reader.IsEmptyElement)
{
- result = await ReadStringAsync(reader);
+ result = await ReadStringAsync(reader).ConfigureAwait(false);
if (reader.NodeType != XmlNodeType.EndElement)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
else
{
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
return result;
@@ -297,7 +296,7 @@ namespace System.ServiceModel.Syndication
{
string result = string.Empty;
- if (await reader.MoveToContentAsync() != XmlNodeType.Element)
+ if (await reader.MoveToContentAsync().ConfigureAwait(false) != XmlNodeType.Element)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
@@ -309,18 +308,18 @@ namespace System.ServiceModel.Syndication
if (!reader.IsEmptyElement)
{
- result = await ReadStringAsync(reader);
+ result = await ReadStringAsync(reader).ConfigureAwait(false);
if (reader.NodeType != XmlNodeType.EndElement)
{
throw CreateXmlException(SR.Format(SR.Xml_InvalidNodeType, reader.NodeType.ToString()), reader);
}
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
else
{
- await reader.ReadAsync();
+ await reader.ReadAsync().ConfigureAwait(false);
}
return result;
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs
index f2ddb2f7c8..2f5fae6db4 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs
@@ -6,7 +6,6 @@ namespace System.ServiceModel.Syndication
{
using System;
using System.Diagnostics;
- using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Xml;
@@ -130,24 +129,24 @@ namespace System.ServiceModel.Syndication
public async Task<XmlDictionaryReader> GetReaderAtContentAsync()
{
- await EnsureContentBufferAsync();
+ await EnsureContentBufferAsync().ConfigureAwait(false);
return _contentBuffer.GetReader(0);
}
public Task<TContent> ReadContentAsync<TContent>()
{
- return ReadContentAsync<TContent>((DataContractSerializer)null);
+ return ReadContentAsync<TContent>((DataContractSerializer) null);
}
public async Task<TContent> ReadContentAsync<TContent>(XmlObjectSerializer dataContractSerializer)
{
if (dataContractSerializer == null)
{
- dataContractSerializer = new DataContractSerializer(typeof(TContent));
+ dataContractSerializer = new DataContractSerializer(typeof (TContent));
}
if (_extension != null)
{
- return await _extension.GetObjectAsync<TContent>(dataContractSerializer);
+ return await _extension.GetObjectAsync<TContent>(dataContractSerializer).ConfigureAwait(false);
}
else
{
@@ -156,7 +155,7 @@ namespace System.ServiceModel.Syndication
{
// skip past the content element
reader.ReadStartElement();
- return (TContent)dataContractSerializer.ReadObject(reader, false);
+ return (TContent) dataContractSerializer.ReadObject(reader, false);
}
}
}
@@ -165,7 +164,7 @@ namespace System.ServiceModel.Syndication
{
if (serializer == null)
{
- serializer = new XmlSerializer(typeof(TContent));
+ serializer = new XmlSerializer(typeof (TContent));
}
if (_extension != null)
{
@@ -178,7 +177,7 @@ namespace System.ServiceModel.Syndication
{
// skip past the content element
reader.ReadStartElement();
- return Task.FromResult((TContent)serializer.Deserialize(reader));
+ return Task.FromResult((TContent) serializer.Deserialize(reader));
//return (TContent)serializer.Deserialize(reader);
}
}
@@ -219,7 +218,7 @@ namespace System.ServiceModel.Syndication
XmlBuffer tmp = new XmlBuffer(int.MaxValue);
using (XmlDictionaryWriter writer = tmp.OpenSection(XmlDictionaryReaderQuotas.Max))
{
- await WriteToAsync(writer, Atom10Constants.ContentTag, Atom10Constants.Atom10Namespace);
+ await WriteToAsync(writer, Atom10Constants.ContentTag, Atom10Constants.Atom10Namespace).ConfigureAwait(false);
}
tmp.CloseSection();
tmp.Close();
diff --git a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs
index 9993669201..8ed1e3c641 100644
--- a/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs
+++ b/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs
@@ -197,24 +197,24 @@ namespace System.ServiceModel.Syndication
writeNodeBuffer = new char[WriteNodeBufferSize];
}
int read;
- while ((read = await reader.ReadValueChunkAsync(writeNodeBuffer, 0, WriteNodeBufferSize)) > 0)
+ while ((read = await reader.ReadValueChunkAsync(writeNodeBuffer, 0, WriteNodeBufferSize).ConfigureAwait(false)) > 0)
{
writer.WriteChars(writeNodeBuffer, 0, read);
}
}
else
{
- writer.WriteString(await reader.GetValueAsync());
+ writer.WriteString(await reader.GetValueAsync().ConfigureAwait(false));
}
break;
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
- writer.WriteWhitespace(await reader.GetValueAsync());
+ writer.WriteWhitespace(await reader.GetValueAsync().ConfigureAwait(false));
break;
case XmlNodeType.CDATA:
- writer.WriteCData(await reader.GetValueAsync());
+ writer.WriteCData(await reader.GetValueAsync().ConfigureAwait(false));
break;
case XmlNodeType.EntityReference:
@@ -223,22 +223,22 @@ namespace System.ServiceModel.Syndication
case XmlNodeType.XmlDeclaration:
case XmlNodeType.ProcessingInstruction:
- writer.WriteProcessingInstruction(reader.Name, await reader.GetValueAsync());
+ writer.WriteProcessingInstruction(reader.Name, await reader.GetValueAsync().ConfigureAwait(false));
break;
case XmlNodeType.DocumentType:
- writer.WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), await reader.GetValueAsync());
+ writer.WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), await reader.GetValueAsync().ConfigureAwait(false));
break;
case XmlNodeType.Comment:
- writer.WriteComment(await reader.GetValueAsync());
+ writer.WriteComment(await reader.GetValueAsync().ConfigureAwait(false));
break;
case XmlNodeType.EndElement:
writer.WriteFullEndElement();
break;
}
- } while (await reader.ReadAsync() && (d < reader.Depth || (d == reader.Depth && reader.NodeType == XmlNodeType.EndElement)));
+ } while (await reader.ReadAsync().ConfigureAwait(false) && (d < reader.Depth || (d == reader.Depth && reader.NodeType == XmlNodeType.EndElement)));
}
}
}