Skip to content

feat: add support for .NET 11 - #1176

Merged
vbreuss merged 1 commit into
mainfrom
feat/net11-support
Nov 1, 2026
Merged

vbreuss merged 1 commit into
mainfrom
feat/net11-support

Conversation

@vbreuss

@vbreuss vbreuss commented Nov 1, 2026

Copy link
Copy Markdown
Member

This PR adds net11.0 as a target framework and mirrors the new .NET 11 APIs in the core abstractions. It is the first of two steps: the core packages need to be released as a pre-release (11.0.0-pre.1) before the main packages can implement the new members, because they consume Testably.Abstractions.Interface as a NuGet package.

Key changes

  • Added the net11.0 target framework to the source and test projects and pinned the .NET 11 SDK (11.0.100-rc.3.26522.148) in global.json. The workflows install it via global-json-file, so moving to the final release only needs a change in global.json.
  • Added the feature flags FEATURE_FILESYSTEM_HARDLINK, FEATURE_FILE_OPENNULLHANDLE and FEATURE_RANDOM_GENERIC
  • Added the new .NET 11 APIs to the abstractions and their real implementations:
    • IFile.CreateHardLink(string, string)
    • IFile.OpenNullHandle()
    • IFileInfo.CreateAsHardLink(string)
    • IRandom.NextInteger<T>()
    • IRandom.NextInteger<T>(T)
    • IRandom.NextInteger<T>(T, T)
    • IRandom.NextBinaryFloat<T>()
  • Added Net11ParityTests and the net11.0 API snapshots
  • Set the BuildScope to CoreOnly, so that only the core packages are built and published

Follow-up

After the core pre-release is published, follow-up PRs will:

  • update the Testably.Abstractions.Interface version range and reset the BuildScope
  • implement hard links, OpenNullHandle and the generic random methods in MockFileSystem and RandomMock
  • add the new .NET 11 compression APIs (password and encryption support, ZipExtractionOptions, ZipFileCreationOptions, IZipArchiveEntry.Open(FileAccess) and the new entry properties)

The parity tests for the compression types and the unit tests of the companion packages on net11.0 only pass after the mock implementations. In CoreOnly the pipeline does not run them.

This PR adds `net11.0` as a target framework and mirrors the new .NET 11 APIs in the core abstractions. It is the first of two steps: the core packages need to be released as a pre-release (`11.0.0-pre.1`) before the main packages can implement the new members, because they consume `Testably.Abstractions.Interface` as a NuGet package.

### Key changes

- Added the `net11.0` target framework to the source and test projects and pinned the .NET 11 SDK (`11.0.100-rc.3.26522.148`) in `global.json`. The workflows install it via `global-json-file`, so moving to the final release only needs a change in `global.json`.
- Added the feature flags `FEATURE_FILESYSTEM_HARDLINK`, `FEATURE_FILE_OPENNULLHANDLE` and `FEATURE_RANDOM_GENERIC`
- Added the new .NET 11 APIs to the abstractions and their real implementations:
  - `IFile.CreateHardLink(string, string)`
  - `IFile.OpenNullHandle()`
  - `IFileInfo.CreateAsHardLink(string)`
  - `IRandom.NextInteger<T>()`
  - `IRandom.NextInteger<T>(T)`
  - `IRandom.NextInteger<T>(T, T)`
  - `IRandom.NextBinaryFloat<T>()`
- Added `Net11ParityTests` and the `net11.0` API snapshots
- Set the `BuildScope` to `CoreOnly`, so that only the core packages are built and published

### Follow-up

After the core pre-release is published, follow-up PRs will:

- update the `Testably.Abstractions.Interface` version range and reset the `BuildScope`
- implement hard links, `OpenNullHandle` and the generic random methods in `MockFileSystem` and `RandomMock`
- add the new .NET 11 compression APIs (password and encryption support, `ZipExtractionOptions`, `ZipFileCreationOptions`, `IZipArchiveEntry.Open(FileAccess)` and the new entry properties)

The parity tests for the compression types and the unit tests of the companion packages on `net11.0` only pass after the mock implementations. In `CoreOnly` the pipeline does not run them.
@vbreuss vbreuss self-assigned this Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Test Results

 1 files   -      61   1 suites   - 61   19s ⏱️ - 1h 17m 28s
14 tests  -  66 178  14 ✅  -  62 666  0 💤  -  3 512  0 ❌ ±0 
14 runs   - 151 372  14 ✅  - 136 611  0 💤  - 14 761  0 ❌ ±0 

Results for commit ef0f013. ± Comparison against base commit ccf0a5f.

This pull request removes 66181 and adds 2 tests. Note that renamed tests count towards both.
  )
)
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests ‑ GetExtensibilityOrThrow_DirectoryInfo_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests ‑ GetExtensibilityOrThrow_FileInfo_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests ‑ GetExtensibilityOrThrow_FileSystemStream_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests ‑ CreateDirectory_NullDirectorySecurity_ShouldThrowArgumentNullException
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests ‑ CreateDirectory_ShouldChangeAccessControl(bar)
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests ‑ CreateDirectory_ShouldChangeAccessControl(bar\foo)
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests ‑ GetAccessControl_ShouldBeInitializedWithNotNullValue
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests ‑ GetAccessControl_ShouldReturnSetResult
…
Testably.Abstractions.Core.Api.Tests.ApiApprovalTests ‑ VerifyPublicApi(Testably·Abstractions·FileSystem·Interface, net11·0)
Testably.Abstractions.Core.Api.Tests.ApiApprovalTests ‑ VerifyPublicApi(Testably·Abstractions·Interface, net11·0)

@mergify

mergify Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@vbreuss
vbreuss merged commit 5cad155 into main Nov 1, 2026
12 checks passed
@vbreuss
vbreuss deleted the feat/net11-support branch November 1, 2026 11:00
vbreuss added a commit that referenced this pull request Nov 1, 2026
…kage

This PR completes the .NET 11 support from #1176. It consumes the `11.0.0-pre.1` core packages, implements the new members in `MockFileSystem` and `MockRandomSystem`, and mirrors the new zip APIs in the compression package, so that the parity tests pass on `net11.0`.

### Key changes

- Updated the `Testably.Abstractions.Interface` version range to `[11.0.0-pre.1,11.1.0)` and reset the `BuildScope`
- Implemented the generic random methods in `RandomMock`; configured generators are used for `int`, `long`, `float` and `double`
  - `IRandom.NextInteger<T>()`, `IRandom.NextInteger<T>(T)`, `IRandom.NextInteger<T>(T, T)`
  - `IRandom.NextBinaryFloat<T>()`
- Added hard link support to `MockFileSystem` (`IFile.CreateHardLink`, `IFileInfo.CreateAsHardLink`)
  - Each path in the in-memory storage now refers to shared file data (content, attributes, timestamps, Unix file mode), so hard links share content and metadata
  - `FileShare` locks are kept per file instead of per path, so opening one link without sharing blocks the others
  - The content and the used drive space are only released when the last link is deleted
  - `Copy`, `Move` and `Replace` between links of the same file and the exceptions of `CreateHardLink` follow the real behaviour on Windows, Linux and macOS
- Added `IFile.OpenNullHandle` to `MockFileSystem`: the handle discards written bytes, returns no data and, like the real handle, only supports seeking on Linux and macOS
- Added the new .NET 11 compression APIs, including the mock implementation
  - `IZipArchive.CreateEntry`, `CreateEntryFromFile` and `CreateEntryFromFileAsync` with a password and `ZipEncryptionMethod`
  - `IZipArchive.ExtractToDirectory(Async)`, `IZipArchiveEntry.ExtractToFile(Async)` and `IZipFile.ExtractToDirectory(Async)` with `ZipExtractionOptions`
  - `IZipFile.CreateFromDirectory(Async)` with `ZipFileCreationOptions`
  - `IZipArchiveEntry.Open(Async)` with `FileAccess` and/or a password, and the properties `CompressionMethod`, `EncryptionMethod` and `VersionMadeBy`
- Added tests against the mocks and the real file system, updated the `net11.0` compression API snapshot and listed .NET 11 in the documentation
vbreuss added a commit that referenced this pull request Nov 1, 2026
…kage (#1177)

This PR completes the .NET 11 support from #1176. It consumes the `11.0.0-pre.1` core packages, implements the new members in `MockFileSystem` and `MockRandomSystem`, mirrors the new zip APIs in the compression package, so that the parity tests pass on `net11.0`, and aligns the mocks with behavior changes of the .NET 11 runtime.

### Key changes

- Updated the `Testably.Abstractions.Interface` version range to `[11.0.0-pre.1,11.1.0)` and reset the `BuildScope`
- Implemented the generic random methods in `RandomMock`; configured generators are used for `int`, `long`, `float` and `double`
  - `IRandom.NextInteger<T>()`, `IRandom.NextInteger<T>(T)`, `IRandom.NextInteger<T>(T, T)`
  - `IRandom.NextBinaryFloat<T>()`
- Added hard link support to `MockFileSystem` (`IFile.CreateHardLink`, `IFileInfo.CreateAsHardLink`)
  - Each path in the in-memory storage now refers to shared file data (content, attributes, timestamps, Unix file mode), so hard links share content and metadata
  - `FileShare` locks are kept per file instead of per path, so opening one link without sharing blocks the others
  - The content and the used drive space are only released when the last link is deleted
  - `Copy`, `Move` and `Replace` between links of the same file and the exceptions of `CreateHardLink` follow the real behavior on Windows, Linux and macOS, including the rejection of `<`, `>` and `"` in either path on Windows
- Added `IFile.OpenNullHandle` to `MockFileSystem`: the handle discards written bytes, returns no data and, like the real handle, only supports seeking on Linux and macOS
- Added the new .NET 11 compression APIs, including the mock implementation
  - `IZipArchive.CreateEntry`, `CreateEntryFromFile` and `CreateEntryFromFileAsync` with a password and `ZipEncryptionMethod`
  - `IZipArchive.ExtractToDirectory(Async)`, `IZipArchiveEntry.ExtractToFile(Async)` and `IZipFile.ExtractToDirectory(Async)` with `ZipExtractionOptions`
  - `IZipFile.CreateFromDirectory(Async)` with `ZipFileCreationOptions`
  - `IZipArchiveEntry.Open(Async)` with `FileAccess` and/or a password, and the properties `CompressionMethod`, `EncryptionMethod` and `VersionMadeBy`
- Aligned the mocks on `net11.0` with behavior changes of the .NET 11 runtime that showed up in CI
  - `IFileInfo.Open`, `OpenRead`, `OpenWrite` and `OpenText` invalidate the cached state, like `Create` already did
  - On Linux and macOS, file streams are never asynchronous, because Unix opens regular files without `O_NONBLOCK`
  - A stream created from a handle follows the handle and ignores the `isAsync` argument
  - On Linux and macOS, `CreateHardLink` with a missing target throws a `DirectoryNotFoundException` when the link path has no directory part, because the runtime only checks the parent of the path as passed
  - On Linux and macOS, `ITimer.Dispose(WaitHandle)` with a `Mutex` or `Semaphore` disposes the timer and then throws an `InvalidOperationException`
- Added tests against the mocks and the real file system, updated the `net11.0` compression API snapshot and listed .NET 11 in the documentation
@github-actions

Copy link
Copy Markdown

This is addressed in release v8.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant