From 5971bfd74398d06a18f186b61a4fb2c50a9ca4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Thu, 16 Nov 2023 14:47:39 +0100 Subject: [PATCH] feat: enable net8.0 (#1032) Support [.NET 8.0.](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) --- .github/workflows/ci.yml | 1 + Directory.Build.props | 8 ++++---- global.json | 2 +- ...O.System.IO.Abstractions.TestingHelpers.csproj | 2 +- ...tableIO.System.IO.Abstractions.Wrappers.csproj | 2 +- .../TestableIO.System.IO.Abstractions.csproj | 3 ++- .../MockFileSystemSerializationTests.cs | 2 +- .../MockFileSystemTests.cs | 2 +- .../MockFileTests.cs | 4 ++-- ...em.IO.Abstractions.TestingHelpers.Tests.csproj | 2 +- .../ApiParityTests.cs | 2 ++ .../FileSystemTests.cs | 2 +- ...O.System.IO.Abstractions.Wrappers.Tests.csproj | 2 +- .../ApiParityTests.DirectoryInfo_.NET 8.0.snap | 9 +++++++++ .../ApiParityTests.Directory_.NET 8.0.snap | 4 ++++ .../ApiParityTests.DriveInfo_.NET 8.0.snap | 7 +++++++ .../ApiParityTests.FileInfo_.NET 8.0.snap | 9 +++++++++ ...ApiParityTests.FileSystemWatcher_.NET 8.0.snap | 15 +++++++++++++++ .../ApiParityTests.File_.NET 8.0.snap | 6 ++++++ .../ApiParityTests.Path_.NET 8.0.snap | 10 ++++++++++ 20 files changed, 79 insertions(+), 15 deletions(-) create mode 100644 tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 8.0.snap create mode 100644 tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Directory_.NET 8.0.snap create mode 100644 tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DriveInfo_.NET 8.0.snap create mode 100644 tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 8.0.snap create mode 100644 tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileSystemWatcher_.NET 8.0.snap create mode 100644 tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.File_.NET 8.0.snap create mode 100644 tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Path_.NET 8.0.snap diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba08d3d0c..3c62f97db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: 5.0.x 6.0.x 7.0.x + 8.0.x - name: Run tests run: dotnet test --collect:"XPlat Code Coverage" --logger "GitHubActions" - name: Upload coverage diff --git a/Directory.Build.props b/Directory.Build.props index 83544b77f..33737a1b1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,10 +11,10 @@ MIT README.md $(DefineConstants);FEATURE_FILE_SYSTEM_ACL_EXTENSIONS - $(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS;FEATURE_PATH_JOIN_WITH_SPAN;FEATURE_SPAN - $(DefineConstants);FEATURE_FILE_MOVE_WITH_OVERWRITE;FEATURE_SUPPORTED_OS_ATTRIBUTE;FEATURE_FILE_SYSTEM_WATCHER_FILTERS;FEATURE_ENDS_IN_DIRECTORY_SEPARATOR;FEATURE_PATH_JOIN_WITH_PARAMS;FEATURE_PATH_JOIN_WITH_FOUR_PATHS - $(DefineConstants);FEATURE_FILE_SYSTEM_INFO_LINK_TARGET;FEATURE_CREATE_SYMBOLIC_LINK;FEATURE_FILESTREAM_OPTIONS - $(DefineConstants);FEATURE_PATH_EXISTS;FEATURE_FILE_SYSTEM_WATCHER_WAIT_WITH_TIMESPAN;FEATURE_FILE_ATTRIBUTES_VIA_HANDLE;FEATURE_CREATE_TEMP_SUBDIRECTORY;FEATURE_READ_LINES_ASYNC;FEATURE_UNIX_FILE_MODE + $(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS;FEATURE_PATH_JOIN_WITH_SPAN;FEATURE_SPAN + $(DefineConstants);FEATURE_FILE_MOVE_WITH_OVERWRITE;FEATURE_SUPPORTED_OS_ATTRIBUTE;FEATURE_FILE_SYSTEM_WATCHER_FILTERS;FEATURE_ENDS_IN_DIRECTORY_SEPARATOR;FEATURE_PATH_JOIN_WITH_PARAMS;FEATURE_PATH_JOIN_WITH_FOUR_PATHS + $(DefineConstants);FEATURE_FILE_SYSTEM_INFO_LINK_TARGET;FEATURE_CREATE_SYMBOLIC_LINK;FEATURE_FILESTREAM_OPTIONS + $(DefineConstants);FEATURE_PATH_EXISTS;FEATURE_FILE_SYSTEM_WATCHER_WAIT_WITH_TIMESPAN;FEATURE_FILE_ATTRIBUTES_VIA_HANDLE;FEATURE_CREATE_TEMP_SUBDIRECTORY;FEATURE_READ_LINES_ASYNC;FEATURE_UNIX_FILE_MODE $(DefineConstants);FEATURE_SERIALIZABLE diff --git a/global.json b/global.json index d4e5a0fa6..c19a2e057 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.404", + "version": "8.0.100", "rollForward": "latestMinor" } } diff --git a/src/TestableIO.System.IO.Abstractions.TestingHelpers/TestableIO.System.IO.Abstractions.TestingHelpers.csproj b/src/TestableIO.System.IO.Abstractions.TestingHelpers/TestableIO.System.IO.Abstractions.TestingHelpers.csproj index 77f0a57e1..6053118a3 100644 --- a/src/TestableIO.System.IO.Abstractions.TestingHelpers/TestableIO.System.IO.Abstractions.TestingHelpers.csproj +++ b/src/TestableIO.System.IO.Abstractions.TestingHelpers/TestableIO.System.IO.Abstractions.TestingHelpers.csproj @@ -3,7 +3,7 @@ TestableIO.System.IO.Abstractions.TestingHelpers System.IO.Abstractions.TestingHelpers A set of pre-built mocks to help when testing file system interactions. - net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461 + net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461 icon_256x256.png diff --git a/src/TestableIO.System.IO.Abstractions.Wrappers/TestableIO.System.IO.Abstractions.Wrappers.csproj b/src/TestableIO.System.IO.Abstractions.Wrappers/TestableIO.System.IO.Abstractions.Wrappers.csproj index 2bc559814..2318648d6 100644 --- a/src/TestableIO.System.IO.Abstractions.Wrappers/TestableIO.System.IO.Abstractions.Wrappers.csproj +++ b/src/TestableIO.System.IO.Abstractions.Wrappers/TestableIO.System.IO.Abstractions.Wrappers.csproj @@ -3,7 +3,7 @@ TestableIO.System.IO.Abstractions.Wrappers System.IO.Abstractions A set of abstractions to help make file system interactions testable. - net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461 + net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461 icon_256x256.png diff --git a/src/TestableIO.System.IO.Abstractions/TestableIO.System.IO.Abstractions.csproj b/src/TestableIO.System.IO.Abstractions/TestableIO.System.IO.Abstractions.csproj index 70a25422d..dd9543ae2 100644 --- a/src/TestableIO.System.IO.Abstractions/TestableIO.System.IO.Abstractions.csproj +++ b/src/TestableIO.System.IO.Abstractions/TestableIO.System.IO.Abstractions.csproj @@ -3,9 +3,10 @@ TestableIO.System.IO.Abstractions System.IO.Abstractions A set of abstractions to help make file system interactions testable. - net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461 + net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461 icon_256x256.png enable + preview diff --git a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemSerializationTests.cs b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemSerializationTests.cs index 2e258eb53..ddb5651f4 100644 --- a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemSerializationTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemSerializationTests.cs @@ -22,9 +22,9 @@ public void SerializationBytes() //Act var memoryStream = new MemoryStream(); +#pragma warning disable SYSLIB0011 var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter(); -#pragma warning disable SYSLIB0011 serializer.Serialize(memoryStream, fileSystem); memoryStream.Flush(); memoryStream.Position = 0; diff --git a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemTests.cs b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemTests.cs index 7f2343d4d..f3df2aca7 100644 --- a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileSystemTests.cs @@ -174,9 +174,9 @@ public void MockFileSystem_ByDefault_IsSerializable() }); var memoryStream = new MemoryStream(); +#pragma warning disable SYSLIB0011 var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter(); -#pragma warning disable SYSLIB0011 serializer.Serialize(memoryStream, fileSystem); #pragma warning restore SYSLIB0011 diff --git a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs index 3c2c6238f..7c0d6c5a1 100644 --- a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs @@ -541,10 +541,10 @@ public void Serializable_works() MockFileData data = new MockFileData("Text Contents"); //Act +#pragma warning disable SYSLIB0011 IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(); -#pragma warning disable SYSLIB0011 formatter.Serialize(stream, data); #pragma warning restore SYSLIB0011 @@ -561,9 +561,9 @@ public void Serializable_can_deserialize() //Act MockFileData data = new MockFileData(textContentStr); +#pragma warning disable SYSLIB0011 IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(); -#pragma warning disable SYSLIB0011 formatter.Serialize(stream, data); stream.Seek(0, SeekOrigin.Begin); diff --git a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests.csproj b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests.csproj index 2b25de3f9..546e5f47d 100644 --- a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests.csproj +++ b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0;netcoreapp3.1 + net8.0;net7.0;net6.0;net5.0;netcoreapp3.1 $(TargetFrameworks);net461 The unit tests for our pre-built mocks System.IO.Abstractions.TestingHelpers.Tests diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/ApiParityTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/ApiParityTests.cs index 755bee9b5..c91de7364 100644 --- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/ApiParityTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/ApiParityTests.cs @@ -109,6 +109,8 @@ public ApiDiff(IEnumerable extraMembers, IEnumerable missingMemb private const string snapshotSuffix = ".NET 6.0"; #elif NET7_0 private const string snapshotSuffix = ".NET 7.0"; +#elif NET8_0 + private const string snapshotSuffix = ".NET 8.0"; #else #error Unknown target framework. #endif diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs index 4905cb453..c4a9268b6 100644 --- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs @@ -12,9 +12,9 @@ public void Is_Serializable() var fileSystem = new FileSystem(); var memoryStream = new MemoryStream(); +#pragma warning disable SYSLIB0011 var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter(); -#pragma warning disable SYSLIB0011 serializer.Serialize(memoryStream, fileSystem); #pragma warning restore SYSLIB0011 diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/TestableIO.System.IO.Abstractions.Wrappers.Tests.csproj b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/TestableIO.System.IO.Abstractions.Wrappers.Tests.csproj index fc1e78949..541e79a62 100644 --- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/TestableIO.System.IO.Abstractions.Wrappers.Tests.csproj +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/TestableIO.System.IO.Abstractions.Wrappers.Tests.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0;netcoreapp3.1 + net8.0;net7.0;net6.0;net5.0;netcoreapp3.1 $(TargetFrameworks);net461 The unit tests for our the core abstractions System.IO.Abstractions.Tests diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 8.0.snap b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 8.0.snap new file mode 100644 index 000000000..c986824b9 --- /dev/null +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 8.0.snap @@ -0,0 +1,9 @@ +{ + "ExtraMembers": [], + "MissingMembers": [ + "System.Object GetLifetimeService()", + "System.Object InitializeLifetimeService()", + "Void .ctor(System.String)", + "Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)" + ] +} diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Directory_.NET 8.0.snap b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Directory_.NET 8.0.snap new file mode 100644 index 000000000..7cb3b9523 --- /dev/null +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Directory_.NET 8.0.snap @@ -0,0 +1,4 @@ +{ + "ExtraMembers": [], + "MissingMembers": [] +} diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DriveInfo_.NET 8.0.snap b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DriveInfo_.NET 8.0.snap new file mode 100644 index 000000000..8c885b472 --- /dev/null +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DriveInfo_.NET 8.0.snap @@ -0,0 +1,7 @@ +{ + "ExtraMembers": [], + "MissingMembers": [ + "System.IO.Abstractions.IDriveInfo[] GetDrives()", + "Void .ctor(System.String)" + ] +} diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 8.0.snap b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 8.0.snap new file mode 100644 index 000000000..c986824b9 --- /dev/null +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 8.0.snap @@ -0,0 +1,9 @@ +{ + "ExtraMembers": [], + "MissingMembers": [ + "System.Object GetLifetimeService()", + "System.Object InitializeLifetimeService()", + "Void .ctor(System.String)", + "Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)" + ] +} diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileSystemWatcher_.NET 8.0.snap b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileSystemWatcher_.NET 8.0.snap new file mode 100644 index 000000000..cfd946350 --- /dev/null +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.FileSystemWatcher_.NET 8.0.snap @@ -0,0 +1,15 @@ +{ + "ExtraMembers": [ + "Void Dispose(Boolean)" + ], + "MissingMembers": [ + "System.EventHandler Disposed", + "System.Object GetLifetimeService()", + "System.Object InitializeLifetimeService()", + "Void .ctor()", + "Void .ctor(System.String)", + "Void .ctor(System.String, System.String)", + "Void add_Disposed(System.EventHandler)", + "Void remove_Disposed(System.EventHandler)" + ] +} diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.File_.NET 8.0.snap b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.File_.NET 8.0.snap new file mode 100644 index 000000000..ce42363ab --- /dev/null +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.File_.NET 8.0.snap @@ -0,0 +1,6 @@ +{ + "ExtraMembers": [], + "MissingMembers": [ + "Microsoft.Win32.SafeHandles.SafeFileHandle OpenHandle(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, System.IO.FileOptions, Int64)" + ] +} diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Path_.NET 8.0.snap b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Path_.NET 8.0.snap new file mode 100644 index 000000000..d83d023ac --- /dev/null +++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Path_.NET 8.0.snap @@ -0,0 +1,10 @@ +{ + "ExtraMembers": [ + "Char get_AltDirectorySeparatorChar()", + "Char get_DirectorySeparatorChar()", + "Char get_PathSeparator()", + "Char get_VolumeSeparatorChar()", + "Char[] get_InvalidPathChars()" + ], + "MissingMembers": [] +}