diff --git a/FileUploader/FileUpload.cs b/FileUploader/FileUpload.cs index 0a7f0d7c7..7aded910c 100644 --- a/FileUploader/FileUpload.cs +++ b/FileUploader/FileUpload.cs @@ -15,7 +15,6 @@ */ using System.Net; -using System.Runtime.InteropServices; using Minio; using Minio.DataModel.Args; @@ -32,8 +31,7 @@ public static class FileUpload { private static bool IsWindows() { - return System.OSPlatform.Windows; - + return OperatingSystem.IsWindows(); } private static async Task Main(string[] args) diff --git a/Minio.Examples/Program.cs b/Minio.Examples/Program.cs index d40b9cbc0..817af18d3 100644 --- a/Minio.Examples/Program.cs +++ b/Minio.Examples/Program.cs @@ -17,7 +17,6 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Net; -using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using Minio.DataModel; @@ -282,7 +281,6 @@ await SetBucketReplication.Run(minioClient, bucketName, destBucketName, replicat File.Delete(smallFileName); File.Delete(bigFileName); - if (System.OSPlatform.Windows;) _ = Console.ReadLine(); - + if (OperatingSystem.IsWindows()) _ = Console.ReadLine(); } } diff --git a/Minio.Functional.Tests/FunctionalTest.cs b/Minio.Functional.Tests/FunctionalTest.cs index f61876f48..423c223d6 100644 --- a/Minio.Functional.Tests/FunctionalTest.cs +++ b/Minio.Functional.Tests/FunctionalTest.cs @@ -20,7 +20,6 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Net; -using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Text.Json; @@ -4817,7 +4816,10 @@ internal static async Task GetObject_3_OffsetLength_Tests(IMinioClient minio) #else await File.WriteAllLinesAsync(tempSource, line).ConfigureAwait(false); #endif - using (var filestream = File.Open(tempSource, FileMode.Open, FileAccess.Read, FileShare.Read)) + FileStream filestream = null; + await + using ((filestream = File.Open(tempSource, FileMode.Open, FileAccess.Read, FileShare.Read)) + .ConfigureAwait(false)) { var objectSize = (int)filestream.Length; var expectedFileSize = lengthToBeRead; @@ -4826,7 +4828,7 @@ internal static async Task GetObject_3_OffsetLength_Tests(IMinioClient minio) { expectedFileSize = objectSize - offsetToStartFrom; var noOfCtrlChars = 1; - if (System.OSPlatform.Windows) noOfCtrlChars = 2; + if (OperatingSystem.IsWindows()) noOfCtrlChars = 2; expectedContent = string.Concat(line) .Substring(offsetToStartFrom, expectedFileSize - noOfCtrlChars);