Skip to content

Commit 2c4d0e5

Browse files
committed
Forgot a couple of ConfigureAwait(false)
1 parent 42d5cfe commit 2c4d0e5

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/Html2OpenXml/HtmlConverter.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public async Task ParseHeader(string html, HeaderFooterValues? headerType = null
125125

126126
var paragraphs = await ParseCoreAsync(html, headerPart, headerImageLoader,
127127
new ParallelOptions() { CancellationToken = cancellationToken },
128-
htmlStyles.GetParagraphStyle(htmlStyles.DefaultStyles.HeaderStyle));
128+
htmlStyles.GetParagraphStyle(htmlStyles.DefaultStyles.HeaderStyle))
129+
.ConfigureAwait(false);
129130

130131
headerPart.Header.Append(paragraphs);
131132
}
@@ -149,7 +150,8 @@ public async Task ParseFooter(string html, HeaderFooterValues? footerType = null
149150

150151
var paragraphs = await ParseCoreAsync(html, footerPart, footerImageLoader,
151152
new ParallelOptions() { CancellationToken = cancellationToken },
152-
htmlStyles.GetParagraphStyle(htmlStyles.DefaultStyles.FooterStyle));
153+
htmlStyles.GetParagraphStyle(htmlStyles.DefaultStyles.FooterStyle))
154+
.ConfigureAwait(false);
153155

154156
footerPart.Footer.Append(paragraphs);
155157
}
@@ -165,7 +167,8 @@ public async Task ParseBody(string html, CancellationToken cancellationToken = d
165167
bodyImageLoader ??= new ImagePrefetcher<MainDocumentPart>(mainPart, webRequester);
166168
var paragraphs = await ParseCoreAsync(html, mainPart, bodyImageLoader,
167169
new ParallelOptions() { CancellationToken = cancellationToken },
168-
htmlStyles.GetParagraphStyle(htmlStyles.DefaultStyles.Paragraph));
170+
htmlStyles.GetParagraphStyle(htmlStyles.DefaultStyles.Paragraph))
171+
.ConfigureAwait(false);
169172

170173
if (!paragraphs.Any())
171174
return;
@@ -285,7 +288,7 @@ private async Task PreloadImages(AngleSharp.Dom.IDocument htmlDocument,
285288
return;
286289

287290
await imageUris.ForEachAsync(
288-
async (img, cts) => await imageLoader.Download(img, cts),
291+
async (img, cts) => await imageLoader.Download(img, cts).ConfigureAwait(false),
289292
parallelOptions).ConfigureAwait(false);
290293
}
291294

src/Html2OpenXml/IO/ImagePrefetcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public ImagePrefetcher(T hostingPart, IWebRequest resourceLoader)
8686
}
8787
else
8888
{
89-
iinfo = await DownloadRemoteImage(imageUri, cancellationToken);
89+
iinfo = await DownloadRemoteImage(imageUri, cancellationToken).ConfigureAwait(false);
9090
}
9191

9292
if (iinfo != null)

src/Html2OpenXml/Utilities/CollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static Task ForEachAsync<T>(this IEnumerable<T> source,
3838
var throttler = new SemaphoreSlim(initialCount: Math.Max(1, parallelOptions.MaxDegreeOfParallelism));
3939
var tasks = System.Linq.Enumerable.Select(source, async item =>
4040
{
41-
await throttler.WaitAsync(parallelOptions.CancellationToken);
41+
await throttler.WaitAsync(parallelOptions.CancellationToken).ConfigureAwait(false);
4242
if (parallelOptions.CancellationToken.IsCancellationRequested) return;
4343

4444
try

0 commit comments

Comments
 (0)