From 3540191da67a576455c3d38f31af7b575f9a3a7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 15:02:59 +0000 Subject: [PATCH 1/3] Bump xunit.runner.visualstudio in the nuget-deps group Bumps the nuget-deps group with 1 update: [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit). Updates `xunit.runner.visualstudio` from 3.0.2 to 3.1.0 - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/3.0.2...3.1.0) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nuget-deps ... Signed-off-by: dependabot[bot] --- UtilitiesTests/UtilitiesTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UtilitiesTests/UtilitiesTests.csproj b/UtilitiesTests/UtilitiesTests.csproj index f56d8a6..bf27233 100644 --- a/UtilitiesTests/UtilitiesTests.csproj +++ b/UtilitiesTests/UtilitiesTests.csproj @@ -25,7 +25,7 @@ - + From 1f35da397080fa4d4601d40a0aeb1f3dc862f21d Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Wed, 21 May 2025 06:36:47 -0700 Subject: [PATCH 2/3] Switch to `charset = utf-8` --- .editorconfig | 2 +- Sandbox/Program.cs | 2 +- Utilities/CommandLineEx.cs | 2 +- Utilities/ConsoleEx.cs | 2 +- Utilities/Download.cs | 2 +- Utilities/Extensions.cs | 2 +- Utilities/FileEx.cs | 2 +- Utilities/FileExOptions.cs | 2 +- Utilities/Format.cs | 2 +- Utilities/Iso6392.cs | 2 +- Utilities/Iso6393.cs | 2 +- Utilities/LogOptions.cs | 2 +- Utilities/ProcessEx.cs | 2 +- Utilities/Rfc5646.cs | 2 +- Utilities/StringCompression.cs | 2 +- Utilities/StringHistory.cs | 2 +- UtilitiesTests/CommandLineTests.cs | 2 +- UtilitiesTests/ConsoleTests.cs | 2 +- UtilitiesTests/DownloadTests.cs | 2 +- UtilitiesTests/FileTests.cs | 2 +- UtilitiesTests/FormatTests.cs | 2 +- UtilitiesTests/Iso6392Tests.cs | 2 +- UtilitiesTests/Iso6393Tests.cs | 2 +- UtilitiesTests/Rfc5646Tests.cs | 2 +- UtilitiesTests/StringCompressionTests.cs | 2 +- UtilitiesTests/UtilitiesTests.cs | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3f89b9a..f6b2fa2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,7 +15,7 @@ root = true # Defaults [*] -charset = utf-8-bom +charset = utf-8 end_of_line = crlf indent_size = 4 indent_style = space diff --git a/Sandbox/Program.cs b/Sandbox/Program.cs index 68250dd..bdfb950 100644 --- a/Sandbox/Program.cs +++ b/Sandbox/Program.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.IO; using System.Reflection; using InsaneGenius.Utilities; diff --git a/Utilities/CommandLineEx.cs b/Utilities/CommandLineEx.cs index 6ee61e9..a1230e1 100644 --- a/Utilities/CommandLineEx.cs +++ b/Utilities/CommandLineEx.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace InsaneGenius.Utilities; diff --git a/Utilities/ConsoleEx.cs b/Utilities/ConsoleEx.cs index 1a2fba0..4a8a8c1 100644 --- a/Utilities/ConsoleEx.cs +++ b/Utilities/ConsoleEx.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Threading; diff --git a/Utilities/Download.cs b/Utilities/Download.cs index 480c691..5ccd758 100644 --- a/Utilities/Download.cs +++ b/Utilities/Download.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Net.Http; using System.Net.Http.Headers; diff --git a/Utilities/Extensions.cs b/Utilities/Extensions.cs index 09094c4..cd4eded 100644 --- a/Utilities/Extensions.cs +++ b/Utilities/Extensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using Serilog; namespace InsaneGenius.Utilities; diff --git a/Utilities/FileEx.cs b/Utilities/FileEx.cs index 2597ed5..42237f4 100644 --- a/Utilities/FileEx.cs +++ b/Utilities/FileEx.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/Utilities/FileExOptions.cs b/Utilities/FileExOptions.cs index a07809c..02a6eab 100644 --- a/Utilities/FileExOptions.cs +++ b/Utilities/FileExOptions.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; namespace InsaneGenius.Utilities; diff --git a/Utilities/Format.cs b/Utilities/Format.cs index 967aaa5..b66dcf6 100644 --- a/Utilities/Format.cs +++ b/Utilities/Format.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace InsaneGenius.Utilities; diff --git a/Utilities/Iso6392.cs b/Utilities/Iso6392.cs index ea1b4bf..bf30c42 100644 --- a/Utilities/Iso6392.cs +++ b/Utilities/Iso6392.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Utilities/Iso6393.cs b/Utilities/Iso6393.cs index f6b874b..1917612 100644 --- a/Utilities/Iso6393.cs +++ b/Utilities/Iso6393.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Utilities/LogOptions.cs b/Utilities/LogOptions.cs index a944544..024e672 100644 --- a/Utilities/LogOptions.cs +++ b/Utilities/LogOptions.cs @@ -1,4 +1,4 @@ -// TODO: Problematic when used in different environments +// TODO: Problematic when used in different environments // using Microsoft.Extensions.Logging; using Serilog; diff --git a/Utilities/ProcessEx.cs b/Utilities/ProcessEx.cs index 8ecc860..9fccb55 100644 --- a/Utilities/ProcessEx.cs +++ b/Utilities/ProcessEx.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Reflection; diff --git a/Utilities/Rfc5646.cs b/Utilities/Rfc5646.cs index 52d8866..3466138 100644 --- a/Utilities/Rfc5646.cs +++ b/Utilities/Rfc5646.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; diff --git a/Utilities/StringCompression.cs b/Utilities/StringCompression.cs index 4ae33f6..51d0092 100644 --- a/Utilities/StringCompression.cs +++ b/Utilities/StringCompression.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.IO.Compression; using System.Text; diff --git a/Utilities/StringHistory.cs b/Utilities/StringHistory.cs index 8be21fc..23a8a35 100644 --- a/Utilities/StringHistory.cs +++ b/Utilities/StringHistory.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; namespace InsaneGenius.Utilities; diff --git a/UtilitiesTests/CommandLineTests.cs b/UtilitiesTests/CommandLineTests.cs index c3bb09b..c4683f2 100644 --- a/UtilitiesTests/CommandLineTests.cs +++ b/UtilitiesTests/CommandLineTests.cs @@ -1,4 +1,4 @@ -using Xunit; +using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/ConsoleTests.cs b/UtilitiesTests/ConsoleTests.cs index d30f99f..f587685 100644 --- a/UtilitiesTests/ConsoleTests.cs +++ b/UtilitiesTests/ConsoleTests.cs @@ -1,4 +1,4 @@ -using Xunit; +using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/DownloadTests.cs b/UtilitiesTests/DownloadTests.cs index 4c1d48f..377b37e 100644 --- a/UtilitiesTests/DownloadTests.cs +++ b/UtilitiesTests/DownloadTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/FileTests.cs b/UtilitiesTests/FileTests.cs index fbd38c3..bb002f5 100644 --- a/UtilitiesTests/FileTests.cs +++ b/UtilitiesTests/FileTests.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/FormatTests.cs b/UtilitiesTests/FormatTests.cs index 8acb694..e42ec72 100644 --- a/UtilitiesTests/FormatTests.cs +++ b/UtilitiesTests/FormatTests.cs @@ -1,4 +1,4 @@ -using Xunit; +using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/Iso6392Tests.cs b/UtilitiesTests/Iso6392Tests.cs index 9eff2b6..52a8e24 100644 --- a/UtilitiesTests/Iso6392Tests.cs +++ b/UtilitiesTests/Iso6392Tests.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using Xunit; diff --git a/UtilitiesTests/Iso6393Tests.cs b/UtilitiesTests/Iso6393Tests.cs index c39b0b6..5e9b204 100644 --- a/UtilitiesTests/Iso6393Tests.cs +++ b/UtilitiesTests/Iso6393Tests.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using Xunit; diff --git a/UtilitiesTests/Rfc5646Tests.cs b/UtilitiesTests/Rfc5646Tests.cs index f48d50e..89b42a9 100644 --- a/UtilitiesTests/Rfc5646Tests.cs +++ b/UtilitiesTests/Rfc5646Tests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using Xunit; diff --git a/UtilitiesTests/StringCompressionTests.cs b/UtilitiesTests/StringCompressionTests.cs index b1f09ef..20d44cc 100644 --- a/UtilitiesTests/StringCompressionTests.cs +++ b/UtilitiesTests/StringCompressionTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Xunit; namespace InsaneGenius.Utilities.Tests; diff --git a/UtilitiesTests/UtilitiesTests.cs b/UtilitiesTests/UtilitiesTests.cs index f37b15f..6e283c9 100644 --- a/UtilitiesTests/UtilitiesTests.cs +++ b/UtilitiesTests/UtilitiesTests.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace InsaneGenius.Utilities.Tests; From 0cab30e7509adc71bc7194e2eb510dac2e60efdc Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 May 2025 09:34:42 -0700 Subject: [PATCH 3/3] Use .GetAwaiter().GetResult() instead of .Result --- Utilities/Download.cs | 11 +++++++---- Utilities/ProcessEx.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Utilities/Download.cs b/Utilities/Download.cs index 5ccd758..defdfef 100644 --- a/Utilities/Download.cs +++ b/Utilities/Download.cs @@ -15,8 +15,11 @@ public static bool GetContentInfo(Uri uri, out long size, out DateTime modifiedT try { // Send GET to URL - using HttpResponseMessage httpResponse = GetHttpClient().GetAsync(uri).Result; - _ = httpResponse.EnsureSuccessStatusCode(); + using HttpResponseMessage httpResponse = GetHttpClient() + .GetAsync(uri) + .GetAwaiter() + .GetResult() + .EnsureSuccessStatusCode(); // Get response size = (long)httpResponse.Content.Headers.ContentLength; @@ -36,7 +39,7 @@ public static bool DownloadFile(Uri uri, string fileName) try { // Get HTTP stream - Stream httpStream = GetHttpClient().GetStreamAsync(uri).Result; + Stream httpStream = GetHttpClient().GetStreamAsync(uri).GetAwaiter().GetResult(); // Get file stream using FileStream fileStream = File.OpenWrite(fileName); @@ -58,7 +61,7 @@ public static bool DownloadString(Uri uri, out string value) value = null; try { - value = GetHttpClient().GetStringAsync(uri).Result; + value = GetHttpClient().GetStringAsync(uri).GetAwaiter().GetResult(); } catch (Exception e) when (LogOptions.Logger.LogAndHandle(e, MethodBase.GetCurrentMethod()?.Name)) diff --git a/Utilities/ProcessEx.cs b/Utilities/ProcessEx.cs index 9fccb55..f378960 100644 --- a/Utilities/ProcessEx.cs +++ b/Utilities/ProcessEx.cs @@ -9,7 +9,7 @@ namespace InsaneGenius.Utilities; public class ProcessEx : Process { public int ExecuteEx(string executable, string parameters) => - ExecuteExAsync(executable, parameters).Result; + ExecuteExAsync(executable, parameters).GetAwaiter().GetResult(); public async Task ExecuteExAsync(string executable, string parameters) {