diff --git a/.editorconfig b/.editorconfig index de42338a..a500e794 100644 --- a/.editorconfig +++ b/.editorconfig @@ -57,6 +57,7 @@ dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_ dotnet_naming_symbols.constant_fields.applicable_kinds = field dotnet_naming_symbols.constant_fields.applicable_accessibilities = * dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_diagnostic.CA2007.severity=warning ############################### # C# Coding Conventions # ############################### @@ -117,6 +118,10 @@ csharp_space_between_method_call_empty_parameter_list_parentheses = false csharp_preserve_single_line_statements = true csharp_preserve_single_line_blocks = true insert_final_newline=false +dotnet_diagnostic.IL3000.severity=error +dotnet_diagnostic.IL3001.severity=error +dotnet_diagnostic.IL3002.severity=error +dotnet_diagnostic.IL3003.severity=error ############################### # VB Coding Conventions # ############################### diff --git a/src/Squirrel/FileDownloader.cs b/src/Squirrel/FileDownloader.cs index 1dd046ea..9dced015 100644 --- a/src/Squirrel/FileDownloader.cs +++ b/src/Squirrel/FileDownloader.cs @@ -57,10 +57,10 @@ namespace Squirrel await this.WarnIfThrows( async () => { - await wc.DownloadFileTaskAsync(failedUrl ?? url, targetFile); + await wc.DownloadFileTaskAsync(failedUrl ?? url, targetFile).ConfigureAwait(false); progress(100); }, - "Failed downloading URL: " + (failedUrl ?? url)); + "Failed downloading URL: " + (failedUrl ?? url)).ConfigureAwait(false); } catch (Exception) { // NB: Some super brain-dead services are case-sensitive yet // corrupt case on upload. I can't even. @@ -84,7 +84,7 @@ namespace Squirrel this.Log().Info("Downloading url: " + (failedUrl ?? url)); return await this.WarnIfThrows(() => wc.DownloadDataTaskAsync(failedUrl ?? url), - "Failed to download url: " + (failedUrl ?? url)); + "Failed to download url: " + (failedUrl ?? url)).ConfigureAwait(false); } catch (Exception) { // NB: Some super brain-dead services are case-sensitive yet // corrupt case on upload. I can't even. diff --git a/src/Squirrel/IUpdateManager.cs b/src/Squirrel/IUpdateManager.cs index 7e91b8d6..a4d3b1fc 100644 --- a/src/Squirrel/IUpdateManager.cs +++ b/src/Squirrel/IUpdateManager.cs @@ -203,19 +203,19 @@ namespace Squirrel try { updateInfo = await This.ErrorIfThrows(() => This.CheckForUpdate(ignoreDeltaUpdates, x => progress(x / 3)), - "Failed to check for updates"); + "Failed to check for updates").ConfigureAwait(false); await This.ErrorIfThrows(() => This.DownloadReleases(updateInfo.ReleasesToApply, x => progress(x / 3 + 33)), - "Failed to download updates"); + "Failed to download updates").ConfigureAwait(false); await This.ErrorIfThrows(() => This.ApplyReleases(updateInfo, x => progress(x / 3 + 66)), - "Failed to apply updates"); + "Failed to apply updates").ConfigureAwait(false); await This.ErrorIfThrows(() => This.CreateUninstallerRegistryEntry(), - "Failed to set up uninstaller"); + "Failed to set up uninstaller").ConfigureAwait(false); } catch { if (ignoreDeltaUpdates == false) { ignoreDeltaUpdates = true; diff --git a/src/Squirrel/Internal/HelperExe.cs b/src/Squirrel/Internal/HelperExe.cs index b6e7f2ce..99359204 100644 --- a/src/Squirrel/Internal/HelperExe.cs +++ b/src/Squirrel/Internal/HelperExe.cs @@ -89,7 +89,7 @@ namespace Squirrel try { // Candle reprocesses and compiles WiX source files into object files (.wixobj). var candleParams = new string[] { "-nologo", "-ext", "WixNetFxExtension", "-out", objFile, wxsTarget }; - var processResult = await Utility.InvokeProcessAsync(WixCandlePath, candleParams, CancellationToken.None, workingDir); + var processResult = await Utility.InvokeProcessAsync(WixCandlePath, candleParams, CancellationToken.None, workingDir).ConfigureAwait(false); if (processResult.Item1 != 0) { var msg = String.Format( @@ -101,7 +101,7 @@ namespace Squirrel // Light links and binds one or more .wixobj files and creates a Windows Installer database (.msi or .msm). var lightParams = new string[] { "-ext", "WixNetFxExtension", "-spdb", "-sval", "-out", outputFile, objFile }; - processResult = await Utility.InvokeProcessAsync(WixLightPath, lightParams, CancellationToken.None, workingDir); + processResult = await Utility.InvokeProcessAsync(WixLightPath, lightParams, CancellationToken.None, workingDir).ConfigureAwait(false); if (processResult.Item1 != 0) { var msg = String.Format( @@ -118,7 +118,7 @@ namespace Squirrel public static async Task SetExeIcon(string exePath, string iconPath) { var args = new[] { Path.GetFullPath(exePath), "--set-icon", iconPath }; - var processResult = await Utility.InvokeProcessAsync(RceditPath, args, CancellationToken.None); + var processResult = await Utility.InvokeProcessAsync(RceditPath, args, CancellationToken.None).ConfigureAwait(false); if (processResult.ExitCode != 0) { var msg = String.Format( @@ -151,7 +151,7 @@ namespace Squirrel args.Add(Path.GetFullPath(iconPath)); } - var processResult = await Utility.InvokeProcessAsync(RceditPath, args, CancellationToken.None); + var processResult = await Utility.InvokeProcessAsync(RceditPath, args, CancellationToken.None).ConfigureAwait(false); if (processResult.ExitCode != 0) { var msg = String.Format( @@ -183,7 +183,7 @@ namespace Squirrel Log.Info("About to sign {0}", exePath); var psi = Utility.CreateProcessStartInfo(SignToolPath, $"sign {signingOpts} \"{exePath}\""); - var processResult = await Utility.InvokeProcessUnsafeAsync(psi, CancellationToken.None); + var processResult = await Utility.InvokeProcessUnsafeAsync(psi, CancellationToken.None).ConfigureAwait(false); if (processResult.ExitCode != 0) { var optsWithPasswordHidden = new Regex(@"/p\s+\w+").Replace(signingOpts, "/p ********"); @@ -200,7 +200,7 @@ namespace Squirrel var args = new string[] { "pack", nuspecPath, "-BasePath", baseDirectory, "-OutputDirectory", outputDirectory }; Log.Info($"Packing '{baseDirectory}' into nupkg."); - var res = await Utility.InvokeProcessAsync(NugetPath, args, CancellationToken.None); + var res = await Utility.InvokeProcessAsync(NugetPath, args, CancellationToken.None).ConfigureAwait(false); if (res.ExitCode != 0) throw new Exception($"Failed nuget pack (exit {res.ExitCode}): \r\n " + res.StdOutput); @@ -220,7 +220,7 @@ namespace Squirrel var psi = Utility.CreateProcessStartInfo(cmd, args); - var result = await Utility.InvokeProcessUnsafeAsync(psi, CancellationToken.None); + var result = await Utility.InvokeProcessUnsafeAsync(psi, CancellationToken.None).ConfigureAwait(false); if (result.ExitCode != 0) throw new Exception(result.StdOutput); } catch (Exception ex) { Log.Error($"Failed to extract file {zipFilePath} to {outFolder}\n{ex.Message}"); @@ -242,7 +242,7 @@ namespace Squirrel var psi = Utility.CreateProcessStartInfo(cmd, args, inFolder); - var result = await Utility.InvokeProcessUnsafeAsync(psi, CancellationToken.None); + var result = await Utility.InvokeProcessUnsafeAsync(psi, CancellationToken.None).ConfigureAwait(false); if (result.ExitCode != 0) throw new Exception(result.StdOutput); } catch (Exception ex) { Log.Error($"Failed to extract file {zipFilePath} to {inFolder}\n{ex.Message}"); diff --git a/src/Squirrel/Internal/Utility.cs b/src/Squirrel/Internal/Utility.cs index f60f176a..4ebe4403 100644 --- a/src/Squirrel/Internal/Utility.cs +++ b/src/Squirrel/Internal/Utility.cs @@ -142,7 +142,7 @@ namespace Squirrel } // XXX: SafeCopy - await Task.Run(() => File.Copy(from, to, true)); + await Task.Run(() => File.Copy(from, to, true)).ConfigureAwait(false); } public static void Retry(this Action block, int retries = 2, int retryDelay = 250) @@ -270,11 +270,11 @@ namespace Squirrel pi.Kill(); ct.ThrowIfCancellationRequested(); } - }); + }).ConfigureAwait(false); - string textResult = await pi.StandardOutput.ReadToEndAsync(); + string textResult = await pi.StandardOutput.ReadToEndAsync().ConfigureAwait(false); if (String.IsNullOrWhiteSpace(textResult) || pi.ExitCode != 0) { - textResult = (textResult ?? "") + "\n" + await pi.StandardError.ReadToEndAsync(); + textResult = (textResult ?? "") + "\n" + await pi.StandardError.ReadToEndAsync().ConfigureAwait(false); if (String.IsNullOrWhiteSpace(textResult)) { textResult = String.Empty; @@ -296,7 +296,7 @@ namespace Squirrel select Task.Run(async () => { using (partition) while (partition.MoveNext()) - await body(partition.Current); + await body(partition.Current).ConfigureAwait(false); })); } @@ -604,7 +604,7 @@ namespace Squirrel public static async Task LogIfThrows(this IFullLogger This, LogLevel level, string message, Func block) { try { - await block(); + await block().ConfigureAwait(false); } catch (Exception ex) { switch (level) { case LogLevel.Debug: @@ -627,7 +627,7 @@ namespace Squirrel public static async Task LogIfThrows(this IFullLogger This, LogLevel level, string message, Func> block) { try { - return await block(); + return await block().ConfigureAwait(false); } catch (Exception ex) { switch (level) { case LogLevel.Debug: diff --git a/src/Squirrel/Runtimes.cs b/src/Squirrel/Runtimes.cs index bedcb7bb..5a36337d 100644 --- a/src/Squirrel/Runtimes.cs +++ b/src/Squirrel/Runtimes.cs @@ -80,11 +80,11 @@ namespace Squirrel /// Download the latest installer for this runtime to the specified file public virtual async Task DownloadToFile(string localPath, Action progress = null) { - var url = await GetDownloadUrl(); + var url = await GetDownloadUrl().ConfigureAwait(false); Log.Info($"Downloading {Id} from {url} to {localPath}"); using var wc = Utility.CreateWebClient(); wc.DownloadProgressChanged += (s, e) => { progress?.Invoke(e); }; - await wc.DownloadFileTaskAsync(url, localPath); + await wc.DownloadFileTaskAsync(url, localPath).ConfigureAwait(false); } /// Execute a runtime installer at a local file path. Typically used after @@ -93,7 +93,7 @@ namespace Squirrel var args = new string[] { "/passive", "/norestart", "/showrmui" }; var quietArgs = new string[] { "/q", "/norestart" }; Log.Info($"Running {Id} installer '{pathToInstaller} {string.Join(" ", args)}'"); - var p = await Utility.InvokeProcessAsync(pathToInstaller, isQuiet ? quietArgs : args, CancellationToken.None); + var p = await Utility.InvokeProcessAsync(pathToInstaller, isQuiet ? quietArgs : args, CancellationToken.None).ConfigureAwait(false); // https://johnkoerner.com/install/windows-installer-error-codes/ @@ -186,7 +186,7 @@ namespace Squirrel { switch (CpuArchitecture) { - case RuntimeCpu.X64: return await CheckIsInstalledX64(); + case RuntimeCpu.X64: return await CheckIsInstalledX64().ConfigureAwait(false); case RuntimeCpu.X86: return CheckIsInstalledX86(); default: return false; @@ -234,7 +234,7 @@ namespace Squirrel // return x64 results, so we can ask it as a last resort try { var token = new CancellationTokenSource(2000).Token; - var output = await Utility.InvokeProcessAsync("dotnet", new[] { "--info" }, token); + var output = await Utility.InvokeProcessAsync("dotnet", new[] { "--info" }, token).ConfigureAwait(false); if (output.ExitCode != 0) return false; return output.StdOutput.Contains("Microsoft.WindowsDesktop.App " + RequiredVersion); } catch (Win32Exception wex) when (wex.HResult == -2147467259) { @@ -261,7 +261,7 @@ namespace Squirrel /// public override async Task GetDownloadUrl() { - var latest = await GetLatestDotNetVersion(DotnetRuntimeType.WindowsDesktop, RequiredVersion); + var latest = await GetLatestDotNetVersion(DotnetRuntimeType.WindowsDesktop, RequiredVersion).ConfigureAwait(false); var architecture = CpuArchitecture switch { RuntimeCpu.X86 => "x86", RuntimeCpu.X64 => "x64", @@ -288,7 +288,7 @@ namespace Squirrel }; using var wc = Utility.CreateWebClient(); - return await wc.DownloadStringTaskAsync(new Uri($"{UncachedDotNetFeed}/{runtime}/{channel}/latest.version")); + return await wc.DownloadStringTaskAsync(new Uri($"{UncachedDotNetFeed}/{runtime}/{channel}/latest.version")).ConfigureAwait(false); } /// diff --git a/src/Squirrel/UpdateManager.ApplyReleases.cs b/src/Squirrel/UpdateManager.ApplyReleases.cs index c0621146..5a49df04 100644 --- a/src/Squirrel/UpdateManager.ApplyReleases.cs +++ b/src/Squirrel/UpdateManager.ApplyReleases.cs @@ -34,14 +34,14 @@ namespace Squirrel progress(0); // Progress range: 00 -> 40 - var release = await createFullPackagesFromDeltas(updateInfo.ReleasesToApply, updateInfo.CurrentlyInstalledVersion, new ApplyReleasesProgress(updateInfo.ReleasesToApply.Count, x => progress(CalculateProgress(x, 0, 40)))); + var release = await createFullPackagesFromDeltas(updateInfo.ReleasesToApply, updateInfo.CurrentlyInstalledVersion, new ApplyReleasesProgress(updateInfo.ReleasesToApply.Count, x => progress(CalculateProgress(x, 0, 40)))).ConfigureAwait(false); progress(40); if (release == null) { if (attemptingFullInstall) { this.Log().Info("No release to install, running the app"); - await invokePostInstall(updateInfo.CurrentlyInstalledVersion.Version, false, true, silentInstall); + await invokePostInstall(updateInfo.CurrentlyInstalledVersion.Version, false, true, silentInstall).ConfigureAwait(false); } progress(100); @@ -50,12 +50,12 @@ namespace Squirrel // Progress range: 40 -> 80 var ret = await this.ErrorIfThrows(() => installPackageToAppDir(updateInfo, release, x => progress(CalculateProgress(x, 40, 80))), - "Failed to install package to app dir"); + "Failed to install package to app dir").ConfigureAwait(false); progress(80); var currentReleases = await this.ErrorIfThrows(() => updateLocalReleasesFile(), - "Failed to update local releases file"); + "Failed to update local releases file").ConfigureAwait(false); progress(85); @@ -65,7 +65,7 @@ namespace Squirrel progress(90); await this.ErrorIfThrows(() => invokePostInstall(newVersion, attemptingFullInstall, false, silentInstall), - "Failed to invoke post-install"); + "Failed to invoke post-install").ConfigureAwait(false); progress(95); @@ -93,7 +93,7 @@ namespace Squirrel var currentVersion = updateInfo.CurrentlyInstalledVersion != null ? updateInfo.CurrentlyInstalledVersion.Version : null; - await cleanDeadVersions(currentVersion, newVersion); + await cleanDeadVersions(currentVersion, newVersion).ConfigureAwait(false); } catch (Exception ex) { this.Log().WarnException("Failed to clean dead versions, continuing anyways", ex); } @@ -131,12 +131,12 @@ namespace Squirrel cts.CancelAfter(10 * 1000); try { - await Utility.InvokeProcessAsync(exe, new string[] { "--squirrel-uninstall", version.ToString() }, cts.Token); + await Utility.InvokeProcessAsync(exe, new string[] { "--squirrel-uninstall", version.ToString() }, cts.Token).ConfigureAwait(false); } catch (Exception ex) { this.Log().ErrorException("Failed to run cleanup hook, continuing: " + exe, ex); } } - }, 1 /*at a time*/); + }, 1 /*at a time*/).ConfigureAwait(false); } else { allApps.ForEach(x => RemoveShortcutsForExecutable(x.Name, ShortcutLocation.StartMenu | ShortcutLocation.Desktop)); } @@ -317,7 +317,7 @@ namespace Squirrel Path.Combine(updateInfo.PackageDirectory, release.Filename), target.FullName, rootAppDirectory, - progressCallback); + progressCallback).ConfigureAwait(false); return target.FullName; }); @@ -358,12 +358,12 @@ namespace Squirrel var basePkg = new ReleasePackage(Path.Combine(rootAppDirectory, "packages", currentVersion.Filename)); var deltaPkg = new ReleasePackage(Path.Combine(rootAppDirectory, "packages", releasesToApply.First().Filename)); - var deltaBuilder = new DeltaPackageBuilder(Directory.GetParent(this.rootAppDirectory).FullName); + var deltaBuilder = new DeltaPackageBuilder(Directory.GetParent(rootAppDirectory).FullName); return deltaBuilder.ApplyDeltaPackage(basePkg, deltaPkg, Regex.Replace(deltaPkg.InputPackageFile, @"-delta.nupkg$", ".nupkg", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant), x => progress.ReportReleaseProgress(x)); - }); + }).ConfigureAwait(false); progress.FinishRelease(); @@ -375,7 +375,7 @@ namespace Squirrel var entry = ReleaseEntry.GenerateFromFile(fi.OpenRead(), fi.Name); // Recursively combine the rest of them - return await createFullPackagesFromDeltas(releasesToApply.Skip(1), entry, progress); + return await createFullPackagesFromDeltas(releasesToApply.Skip(1), entry, progress).ConfigureAwait(false); } void executeSelfUpdate(SemanticVersion currentVersion) @@ -418,12 +418,12 @@ namespace Squirrel cts.CancelAfter(15 * 1000); try { - await Utility.InvokeProcessAsync(exe, args, cts.Token); + await Utility.InvokeProcessAsync(exe, args, cts.Token).ConfigureAwait(false); } catch (Exception ex) { this.Log().ErrorException("Couldn't run Squirrel hook, continuing: " + exe, ex); } } - }, 1 /* at a time */); + }, 1 /* at a time */).ConfigureAwait(false); // If this is the first run, we run the apps with first-run and // *don't* wait for them, since they're probably the main EXE @@ -612,14 +612,14 @@ namespace Squirrel cts.CancelAfter(10 * 1000); try { - await Utility.InvokeProcessAsync(exe, args, cts.Token); + await Utility.InvokeProcessAsync(exe, args, cts.Token).ConfigureAwait(false); } catch (Exception ex) { this.Log().ErrorException("Coudln't run Squirrel hook, continuing: " + exe, ex); } } - }, 1 /* at a time */); + }, 1 /* at a time */).ConfigureAwait(false); } - }); + }).ConfigureAwait(false); } // Include dead folders in folders to :fire: @@ -650,7 +650,7 @@ namespace Squirrel // NB: Same deal as above markAppFolderAsDead(x.FullName); } - }); + }).ConfigureAwait(false); // Clean up the packages directory too var releasesFile = Utility.LocalReleaseFileForAppDir(rootAppDirectory); @@ -682,7 +682,7 @@ namespace Squirrel internal async Task> updateLocalReleasesFile() { - return await Task.Run(() => ReleaseEntry.BuildReleasesFile(Utility.PackageDirectoryForAppDir(rootAppDirectory))); + return await Task.Run(() => ReleaseEntry.BuildReleasesFile(Utility.PackageDirectoryForAppDir(rootAppDirectory))).ConfigureAwait(false); } IEnumerable getReleases() diff --git a/src/Squirrel/UpdateManager.CheckForUpdates.cs b/src/Squirrel/UpdateManager.CheckForUpdates.cs index 8c93983d..6251aa53 100644 --- a/src/Squirrel/UpdateManager.CheckForUpdates.cs +++ b/src/Squirrel/UpdateManager.CheckForUpdates.cs @@ -77,7 +77,7 @@ namespace Squirrel }); } - var data = await urlDownloader.DownloadUrl(uri.ToString()); + var data = await urlDownloader.DownloadUrl(uri.ToString()).ConfigureAwait(false); releaseFile = Encoding.UTF8.GetString(data); } catch (WebException ex) { this.Log().InfoException("Download resulted in WebException (returning blank release list)", ex); diff --git a/src/Squirrel/UpdateManager.DownloadReleases.cs b/src/Squirrel/UpdateManager.DownloadReleases.cs index a25ef662..5ac10796 100644 --- a/src/Squirrel/UpdateManager.DownloadReleases.cs +++ b/src/Squirrel/UpdateManager.DownloadReleases.cs @@ -39,10 +39,10 @@ namespace Squirrel component = toIncrement / 100.0 * p; progress((int) Math.Round(current += component)); } - }); + }).ConfigureAwait(false); checksumPackage(x); - }); + }).ConfigureAwait(false); } else { // From Disk await releasesToDownload.ForEachAsync(x => { @@ -55,7 +55,7 @@ namespace Squirrel lock (progress) progress((int) Math.Round(current += toIncrement)); checksumPackage(x); - }); + }).ConfigureAwait(false); } } diff --git a/src/Squirrel/UpdateManager.Factory.cs b/src/Squirrel/UpdateManager.Factory.cs index f6102b20..2463444f 100644 --- a/src/Squirrel/UpdateManager.Factory.cs +++ b/src/Squirrel/UpdateManager.Factory.cs @@ -65,10 +65,10 @@ namespace Squirrel using (var client = new HttpClient() { BaseAddress = baseAddress }) { client.DefaultRequestHeaders.UserAgent.Add(userAgent); - var response = await client.GetAsync(releasesApiBuilder.ToString()); + var response = await client.GetAsync(releasesApiBuilder.ToString()).ConfigureAwait(false); response.EnsureSuccessStatusCode(); - var releases = SimpleJson.DeserializeObject>(await response.Content.ReadAsStringAsync()); + var releases = SimpleJson.DeserializeObject>(await response.Content.ReadAsStringAsync().ConfigureAwait(false)); var latestRelease = releases .Where(x => prerelease || !x.Prerelease) .OrderByDescending(x => x.PublishedAt) diff --git a/src/Squirrel/UpdateManager.InstallHelpers.cs b/src/Squirrel/UpdateManager.InstallHelpers.cs index 18b1b2e7..76cca01a 100644 --- a/src/Squirrel/UpdateManager.InstallHelpers.cs +++ b/src/Squirrel/UpdateManager.InstallHelpers.cs @@ -54,7 +54,7 @@ namespace Squirrel var targetIco = Path.Combine(rootAppDirectory, "app.ico"); using (var iconStream = iconFile.GetStream()) using (var targetStream = File.Open(targetIco, FileMode.Create, FileAccess.Write)) - await iconStream.CopyToAsync(targetStream); + await iconStream.CopyToAsync(targetStream).ConfigureAwait(false); this.Log().Info($"File '{targetIco}' is being used for uninstall icon."); key.SetValue("DisplayIcon", targetIco, RegistryValueKind.String); } catch (Exception ex) { diff --git a/src/Squirrel/UpdateManager.cs b/src/Squirrel/UpdateManager.cs index ad0119e5..992fb53f 100644 --- a/src/Squirrel/UpdateManager.cs +++ b/src/Squirrel/UpdateManager.cs @@ -58,48 +58,48 @@ namespace Squirrel { var checkForUpdate = new CheckForUpdateImpl(rootAppDirectory); - await acquireUpdateLock(); - return await checkForUpdate.CheckForUpdate(intention, Utility.LocalReleaseFileForAppDir(rootAppDirectory), updateUrlOrPath, ignoreDeltaUpdates, progress, urlDownloader); + await acquireUpdateLock().ConfigureAwait(false); + return await checkForUpdate.CheckForUpdate(intention, Utility.LocalReleaseFileForAppDir(rootAppDirectory), updateUrlOrPath, ignoreDeltaUpdates, progress, urlDownloader).ConfigureAwait(false); } /// public async Task DownloadReleases(IEnumerable releasesToDownload, Action progress = null) { var downloadReleases = new DownloadReleasesImpl(rootAppDirectory); - await acquireUpdateLock(); + await acquireUpdateLock().ConfigureAwait(false); - await downloadReleases.DownloadReleases(updateUrlOrPath, releasesToDownload, progress, urlDownloader); + await downloadReleases.DownloadReleases(updateUrlOrPath, releasesToDownload, progress, urlDownloader).ConfigureAwait(false); } /// public async Task ApplyReleases(UpdateInfo updateInfo, Action progress = null) { var applyReleases = new ApplyReleasesImpl(rootAppDirectory); - await acquireUpdateLock(); + await acquireUpdateLock().ConfigureAwait(false); - return await applyReleases.ApplyReleases(updateInfo, false, false, progress); + return await applyReleases.ApplyReleases(updateInfo, false, false, progress).ConfigureAwait(false); } /// public async Task FullInstall(bool silentInstall = false, Action progress = null) { - var updateInfo = await CheckForUpdate(intention: UpdaterIntention.Install); - await DownloadReleases(updateInfo.ReleasesToApply); + var updateInfo = await CheckForUpdate(intention: UpdaterIntention.Install).ConfigureAwait(false); + await DownloadReleases(updateInfo.ReleasesToApply).ConfigureAwait(false); var applyReleases = new ApplyReleasesImpl(rootAppDirectory); - await acquireUpdateLock(); + await acquireUpdateLock().ConfigureAwait(false); - await applyReleases.ApplyReleases(updateInfo, silentInstall, true, progress); + await applyReleases.ApplyReleases(updateInfo, silentInstall, true, progress).ConfigureAwait(false); } /// public async Task FullUninstall() { var applyReleases = new ApplyReleasesImpl(rootAppDirectory); - await acquireUpdateLock(); + await acquireUpdateLock().ConfigureAwait(false); this.KillAllExecutablesBelongingToPackage(); - await applyReleases.FullUninstall(); + await applyReleases.FullUninstall().ConfigureAwait(false); } /// @@ -271,7 +271,7 @@ namespace Squirrel var updateProcess = Process.Start(getUpdateExe(), String.Format("--processStartAndWait {0} {1}", exeToStart, argsArg)); - await Task.Delay(500); + await Task.Delay(500).ConfigureAwait(false); return updateProcess; } diff --git a/src/SquirrelCli/SquirrelCli.csproj b/src/SquirrelCli/SquirrelCli.csproj index 3d0fbeaa..70b6295b 100644 --- a/src/SquirrelCli/SquirrelCli.csproj +++ b/src/SquirrelCli/SquirrelCli.csproj @@ -13,6 +13,7 @@ true true true + CA2007 diff --git a/src/Update/Update.csproj b/src/Update/Update.csproj index eafa2d76..2ca27579 100644 --- a/src/Update/Update.csproj +++ b/src/Update/Update.csproj @@ -12,6 +12,7 @@ true true true + CA2007