Add ConfigureAwait(false)

This commit is contained in:
Malte Rosenbjerg 2021-03-06 23:05:38 +01:00
parent e49290b217
commit a12c322de9

View file

@ -62,13 +62,13 @@ public static async Task<IMediaAnalysis> AnalyseAsync(string filePath, int outpu
throw new FFMpegException(FFMpegExceptionType.File, $"No file found at '{filePath}'"); throw new FFMpegException(FFMpegExceptionType.File, $"No file found at '{filePath}'");
using var instance = PrepareInstance(filePath, outputCapacity); using var instance = PrepareInstance(filePath, outputCapacity);
await instance.FinishedRunning(); await instance.FinishedRunning().ConfigureAwait(false);
return ParseOutput(instance); return ParseOutput(instance);
} }
public static async Task<IMediaAnalysis> AnalyseAsync(Uri uri, int outputCapacity = int.MaxValue) public static async Task<IMediaAnalysis> AnalyseAsync(Uri uri, int outputCapacity = int.MaxValue)
{ {
using var instance = PrepareInstance(uri.AbsoluteUri, outputCapacity); using var instance = PrepareInstance(uri.AbsoluteUri, outputCapacity);
await instance.FinishedRunning(); await instance.FinishedRunning().ConfigureAwait(false);
return ParseOutput(instance); return ParseOutput(instance);
} }
public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, int outputCapacity = int.MaxValue) public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, int outputCapacity = int.MaxValue)
@ -81,7 +81,7 @@ public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, int outputC
var task = instance.FinishedRunning(); var task = instance.FinishedRunning();
try try
{ {
await pipeArgument.During(); await pipeArgument.During().ConfigureAwait(false);
} }
catch(IOException) catch(IOException)
{ {
@ -90,7 +90,7 @@ public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, int outputC
{ {
pipeArgument.Post(); pipeArgument.Post();
} }
var exitCode = await task; var exitCode = await task.ConfigureAwait(false);
if (exitCode != 0) if (exitCode != 0)
throw new FFMpegException(FFMpegExceptionType.Process, $"FFProbe process returned exit status {exitCode}", null, string.Join("\n", instance.ErrorData)); throw new FFMpegException(FFMpegExceptionType.Process, $"FFProbe process returned exit status {exitCode}", null, string.Join("\n", instance.ErrorData));