diff --git a/src/Umbraco.Core/XmlExtensions.cs b/src/Umbraco.Core/XmlExtensions.cs index 8784cbfb30..200b845002 100644 --- a/src/Umbraco.Core/XmlExtensions.cs +++ b/src/Umbraco.Core/XmlExtensions.cs @@ -38,7 +38,7 @@ namespace Umbraco.Core //NOTE: There are no nice methods to write it async, only flushing it async. We // could implement this ourselves but it'd be a very manual process. xdoc.WriteTo(xmlWriter); - await xmlWriter.FlushAsync(); + await xmlWriter.FlushAsync().ConfigureAwait(false); } } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheFilePersister.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheFilePersister.cs index 9fd58eedbc..07e1f055cf 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheFilePersister.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheFilePersister.cs @@ -133,7 +133,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { LogHelper.Debug("Run now."); var doc = _content.XmlContentInternal; - await PersistXmlToFileAsync(doc); + await PersistXmlToFileAsync(doc).ConfigureAwait(false); } public bool IsAsync @@ -161,7 +161,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // create dir if it is not there, if it's there, this will proceed as normal Directory.CreateDirectory(directoryName); - await xmlDoc.SaveAsync(_xmlFileName); + await xmlDoc.SaveAsync(_xmlFileName).ConfigureAwait(false); } catch (Exception ee) { diff --git a/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs b/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs index d72af8bccd..7f3606474a 100644 --- a/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs +++ b/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs @@ -376,7 +376,8 @@ namespace Umbraco.Web.Scheduling using (bgTask) // ensure it's disposed { if (bgTask.IsAsync) - await bgTask.RunAsync(token); + //configure await = false since we don't care about the context, we're on a background thread. + await bgTask.RunAsync(token).ConfigureAwait(false); else bgTask.Run(); }