From 06283b71642d7ab655df287a006826e5b594f4b6 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 21 Aug 2026 21:38:43 +1000 Subject: [PATCH] Fix IsAsync expectations for .NET 11 on Unix FileStream.IsAsync is now false for regular files on Unix. See https://github.com/dotnet/runtime/pull/125220 --- tests/ImageSharp.Tests/IO/LocalFileSystemTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/ImageSharp.Tests/IO/LocalFileSystemTests.cs b/tests/ImageSharp.Tests/IO/LocalFileSystemTests.cs index a1eeb2597..56864680d 100644 --- a/tests/ImageSharp.Tests/IO/LocalFileSystemTests.cs +++ b/tests/ImageSharp.Tests/IO/LocalFileSystemTests.cs @@ -50,7 +50,12 @@ public class LocalFileSystemTests await using (FileStream stream = (FileStream)fs.OpenReadAsynchronous(path)) using (StreamReader reader = new(stream)) { + // .NET 11 reports IsAsync false for regular files on Unix: https://github.com/dotnet/runtime/pull/125220 +#if NET11_0_OR_GREATER + Assert.Equal(OperatingSystem.IsWindows(), stream.IsAsync); +#else Assert.True(stream.IsAsync); +#endif Assert.True(stream.CanRead); Assert.False(stream.CanWrite); @@ -105,7 +110,12 @@ public class LocalFileSystemTests await using (FileStream stream = (FileStream)fs.CreateAsynchronous(path)) await using (StreamWriter writer = new(stream)) { + // .NET 11 reports IsAsync false for regular files on Unix: https://github.com/dotnet/runtime/pull/125220 +#if NET11_0_OR_GREATER + Assert.Equal(OperatingSystem.IsWindows(), stream.IsAsync); +#else Assert.True(stream.IsAsync); +#endif Assert.True(stream.CanRead); Assert.True(stream.CanWrite);