diff --git a/.github/workflows/build-container-bookworm-slim.yml b/.github/workflows/build-container-bookworm-slim.yml deleted file mode 100644 index adb8e5ac096..00000000000 --- a/.github/workflows/build-container-bookworm-slim.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Build Bookworm Slim Container - -on: - pull_request: - paths-ignore: - - "docs/**" - - "samples/**" - - "**.md" - push: - branches: - - master - - release/* - tags: - - oss-v* - - v* - paths-ignore: - - "docs/**" - - "samples/**" - - "**.md" - -jobs: - build-container: - uses: ./.github/workflows/build-container-reusable.yml - with: - container-runtime: bookworm-slim - diff --git a/.github/workflows/build-container-jammy.yml b/.github/workflows/build-container-noble.yml similarity index 85% rename from .github/workflows/build-container-jammy.yml rename to .github/workflows/build-container-noble.yml index f032d7204d7..f91021690a8 100644 --- a/.github/workflows/build-container-jammy.yml +++ b/.github/workflows/build-container-noble.yml @@ -1,4 +1,4 @@ -name: Build Jammy Container +name: Build Noble Container on: pull_request: @@ -22,5 +22,5 @@ jobs: build-container: uses: ./.github/workflows/build-container-reusable.yml with: - container-runtime: jammy + container-runtime: noble diff --git a/.github/workflows/build-container-reusable.yml b/.github/workflows/build-container-reusable.yml index a0886249edb..a343048bae7 100644 --- a/.github/workflows/build-container-reusable.yml +++ b/.github/workflows/build-container-reusable.yml @@ -16,10 +16,10 @@ jobs: name: Checkout uses: actions/checkout@v4 - - name: Install net8.0 + name: Install net10.0 uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 10.0.x - name: Setup QEMU uses: docker/setup-qemu-action@v2 @@ -41,10 +41,7 @@ jobs: key: "${{ inputs.container-runtime }}" map: | { - "jammy": { - "runtime": "linux-x64" - }, - "bookworm-slim": { + "noble": { "runtime": "linux-x64" }, "alpine": { diff --git a/.github/workflows/build-reusable.yml b/.github/workflows/build-reusable.yml index 8ce18e46422..fd9e4682705 100644 --- a/.github/workflows/build-reusable.yml +++ b/.github/workflows/build-reusable.yml @@ -48,10 +48,10 @@ jobs: if: ${{ !startsWith(inputs.os, 'windows') }} uses: docker/setup-buildx-action@v2 - - name: Install net8.0 + name: Install net10.0 uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 10.0.x - name: Clear Nuget Cache shell: powershell @@ -71,6 +71,7 @@ jobs: shell: bash run: | dotnet run --project src/KurrentDB --configuration ${{ matrix.configuration }} -- --insecure --what-if + # so that the oauth tests have an up to date server image to run against - name: Build Test Image if: ${{ !startsWith(inputs.os, 'windows') }} diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 25a625fcae5..60f38fa233a 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -27,10 +27,10 @@ jobs: name: Checkout uses: actions/checkout@v4 - - name: Install net8.0 + name: Install net10.0 uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 10.0.x - name: Scan for Vulnerabilities run: | diff --git a/CLAUDE.md b/CLAUDE.md index 7381dadd08b..786fb7ed9ce 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -28,9 +28,7 @@ KurrentDB 25.1 introduces several major features and improvements: ## Development Commands ### Build -- `./build.sh [version] [configuration]` - Build KurrentDB (Linux/MacOS) -- `./build.ps1 [version] [configuration]` - Build KurrentDB (Windows) -- `dotnet build -c Release /p:Platform=x64 --framework=net8.0 src/KurrentDB.sln` - Direct dotnet build +- `dotnet build -c Release /p:Platform=x64 --framework=net10.0 src/KurrentDB.sln` - Direct dotnet build ### Test - `dotnet test src/KurrentDB.sln` - Run all tests @@ -43,7 +41,7 @@ Navigate to the test project directory and use: - `dotnet test --filter "TestClass"` ### Development Server -- Start server: `dotnet ./src/KurrentDB/bin/Release/net8.0/KurrentDB.dll --dev --db ./tmp/data --index ./tmp/index --log ./tmp/log` +- Start server: `dotnet ./src/KurrentDB/bin/Release/net10.0/KurrentDB.dll --dev --db ./tmp/data --index ./tmp/index --log ./tmp/log` - Default ports: HTTP/gRPC on 2113, Internal TCP on 1112 - Admin UI: `http://localhost:2113` (new embedded UI) or `http://localhost:2113/web` (legacy) - Windows Service: KurrentDB can now be run as a Windows Service (see installation docs) @@ -185,7 +183,7 @@ Uses centralized package management: ### Development Notes -- Target framework: .NET 8.0 with Server GC enabled by default +- Target framework: .NET 10.0 with Server GC enabled by default - Uses unsafe code blocks for performance-critical operations - Protocol buffer generation integrated into build process (`KurrentDB.Protocol` project) - Extensive use of dependency injection and hosted services pattern diff --git a/Dockerfile b/Dockerfile index 07782d7cdb2..e5fd14572ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # "build" image -ARG CONTAINER_RUNTIME=jammy -# NOT A BUG: we can't build on alpine so we use jammy as a base image -FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build +ARG CONTAINER_RUNTIME=noble +# NOT A BUG: we can't build on alpine so we use noble as a base image +FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build ARG RUNTIME=linux-x64 WORKDIR /build @@ -22,14 +22,14 @@ COPY ./src/KurrentDB.sln ./src/*/*.csproj ./src/Directory.Build.* ./src/Director RUN for file in $(ls Connectors/*.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done && \ for file in $(ls SchemaRegistry/*.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done && \ for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done && \ - dotnet restore --runtime=${RUNTIME} + dotnet restore COPY ./src . WORKDIR /build/.git COPY ./.git/ . # "test" image -FROM mcr.microsoft.com/dotnet/sdk:8.0-${CONTAINER_RUNTIME} AS test +FROM mcr.microsoft.com/dotnet/sdk:10.0-${CONTAINER_RUNTIME} AS test WORKDIR /build COPY --from=build ./build/src ./src COPY --from=build ./build/ci ./ci @@ -57,13 +57,13 @@ FROM build AS publish ARG RUNTIME=linux-x64 RUN dotnet publish --configuration=Release --runtime=${RUNTIME} --self-contained \ - --framework=net8.0 --output /publish /build/src/KurrentDB + --framework=net10.0 --output /publish /build/src/KurrentDB # "runtime" image -FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-${CONTAINER_RUNTIME} AS runtime +FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-${CONTAINER_RUNTIME} AS runtime ARG RUNTIME=linux-x64 -ARG UID=1000 -ARG GID=1000 +ARG UID=1001 +ARG GID=1001 RUN if [[ "${RUNTIME}" = "linux-musl-x64" ]];\ then \ @@ -73,6 +73,7 @@ RUN if [[ "${RUNTIME}" = "linux-musl-x64" ]];\ else \ apt update && \ apt install -y \ + adduser \ curl && \ rm -rf /var/lib/apt/lists/*; \ fi diff --git a/README.md b/README.md index 11c11bdb88f..57c8d5486db 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ KurrentDB is written in a mixture of C# and JavaScript. It can run on Windows, L **Prerequisites** -- [.NET SDK 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) +- [.NET SDK 10.0](https://dotnet.microsoft.com/download/dotnet/10.0) Once you've installed the prerequisites for your system, you can launch a `Release` build of KurrentDB as follows: @@ -125,12 +125,10 @@ Once you've installed the prerequisites for your system, you can launch a `Relea dotnet build -c Release src ``` -The build scripts: `build.sh` and `build.ps1` are also available for Linux and Windows respectively to simplify the build process. - To start a single node, you can then run: ``` -dotnet ./src/KurrentDB/bin/Release/net8.0/KurrentDB.dll --dev --db ./tmp/data --index ./tmp/index --log ./tmp/log +dotnet ./src/KurrentDB/bin/Release/net10.0/KurrentDB.dll --dev --db ./tmp/data --index ./tmp/index --log ./tmp/log ``` ### Running the tests @@ -155,7 +153,7 @@ For instance: ``` docker build --tag mykurrentdb . \ ---build-arg CONTAINER_RUNTIME=bookworm-slim \ +--build-arg CONTAINER_RUNTIME=noble \ --build-arg RUNTIME=linux-x64 ``` @@ -163,27 +161,17 @@ docker build --tag mykurrentdb . \ ``` $env:DOCKER_BUILDKIT=0; docker build --tag mykurrentdb . ` ---build-arg CONTAINER_RUNTIME=bookworm-slim ` +--build-arg CONTAINER_RUNTIME=noble ` --build-arg RUNTIME=linux-x64 ``` Currently, we support the following configurations: -1. Bookworm slim: - -- `CONTAINER_RUNTIME=bookworm-slim` -- `RUNTIME=linux-x64` - -2. Jammy: +1. Noble: -- `CONTAINER_RUNTIME=Jammy` +- `CONTAINER_RUNTIME=noble` - `RUNTIME=linux-x64` -3. Alpine: - -- `CONTAINER_RUNTIME=alpine` -- `RUNTIME=linux-musl-x64` - You can verify the built image by running: ``` diff --git a/build.cmd b/build.cmd deleted file mode 100644 index 1054e205086..00000000000 --- a/build.cmd +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -if '%1'=='/?' goto help -if '%1'=='/help' goto help -if '%1'=='--help' goto help -if '%1'=='-help' goto help -if '%1'=='-h' goto help - -powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\build.ps1' %*;" -exit /B %errorlevel% - -:help - -echo Usage: -echo build.cmd ^[-Version=0.0.0.0^] ^[-Configuration=Debug^|Release^] -echo. -echo Prerequisites: -echo Building KurrentDB database requires .NET Core SDK 8.0 diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 41eb7a5a5c8..00000000000 --- a/build.ps1 +++ /dev/null @@ -1,74 +0,0 @@ -[CmdletBinding()] -Param( - [Parameter(HelpMessage="Assembly version number (x.y.z.0 where x.y.z is the semantic version)")] - [string]$Version = "0.0.0.0", - [Parameter(HelpMessage="Configuration (Debug, Release)")] - [ValidateSet("Debug","Release")] - [string]$Configuration = "Release", - [Parameter(HelpMessage="Run Tests (yes,no)")] - [ValidateSet("yes","no")] - [string]$RunTests = "no" -) - -Function Write-Info { - Param([string]$message) - Process { - Write-Host $message -ForegroundColor Cyan - } -} - -#Borrowed from psake -Function Exec -{ - [CmdletBinding()] - param( - [Parameter(Mandatory=$true, Position=0)][scriptblock]$Command, - [Parameter(Mandatory=$false, Position=1)][string]$ErrorMessage = ("Failed executing {0}" -F $Command) - ) - - & $Command - if ($LASTEXITCODE -ne 0) { - throw ("Exec: " + $ErrorMessage) - } -} - -Function Start-Build{ - #Make compatible with Powershell 2 - if(!$PSScriptRoot) { $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent } - - #Configuration - $platform = "x64" - - $baseDirectory = $PSScriptRoot - $srcDirectory = Join-Path $baseDirectory "src" - $binDirectory = Join-Path $baseDirectory "bin" - $kurrentDbSolution = Join-Path $srcDirectory "KurrentDB.sln" - - Write-Info "Build Configuration" - Write-Info "-------------------" - - Write-Info "Version: $Version" - Write-Info "Platform: $platform" - Write-Info "Configuration: $Configuration" - Write-Info "Run Tests: $RunTests" - - #Build KurrentDB (Patch AssemblyInfo, Build, Revert AssemblyInfo) - Remove-Item -Force -Recurse $binDirectory -ErrorAction SilentlyContinue > $null - - $versionInfoFile = Resolve-Path (Join-Path $srcDirectory (Join-Path "KurrentDB.Common" (Join-Path "Utils" "VersionInfo.cs"))) -Relative - try { - Exec { dotnet build -c $configuration /p:Version=$Version /p:Platform=x64 $kurrentDbSolution } - } finally { - Write-Info "Reverting $versionInfoFile to original state." - & { git checkout --quiet $versionInfoFile } - } - if($RunTests -eq "yes"){ - (Get-ChildItem -Attributes Directory src | % FullName) -Match '.Tests' | ` - ForEach-Object { - dotnet test -v normal -c $Configuration /p:Platform=x64 --no-build --logger trx --results-directory testResults $_ - if (-Not $?) { throw "Exit code is $?" } - } - } -} - -Start-Build diff --git a/build.sh b/build.sh deleted file mode 100755 index ba5e4eb3beb..00000000000 --- a/build.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env bash - -BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -PRODUCTNAME="KurrentDB" -COMPANYNAME="Kurrent, Inc" -COPYRIGHT="Copyright 2025 Kurrent, Inc. All rights reserved." - - -# ------------ End of configuration ------------- - -CONFIGURATION="Release" -NET_FRAMEWORK="net8.0" - -function usage() { -cat <] [] - -version: KurrentDB build version. Versions must be complete four part identifiers valid for use on a .NET assembly. - -configuration: Build configuration. Valid configurations are: Debug, Release - -EOF - exit 1 -} - -function detectOS(){ - unameOut="$(uname -s)" - case "${unameOut}" in - Linux*) os=Linux;; - Darwin*) os=MacOS;; - *) os="${unameOut}" - esac - - if [[ "$os" != "Linux" && $os != "MacOS" ]] ; then - echo "Unsupported operating system: $os. Only Linux and MacOS are supported." - exit 1 - fi - OS=$os -} - -function checkParams() { - if [[ "$1" == "-help" || "$1" == "--help" ]] ; then - usage - fi - - version=$1 - configuration=$2 - - [[ $# -gt 2 ]] && usage - - if [[ "$version" == "" ]] ; then - VERSIONSTRING="0.0.0.0" - echo "Version defaulted to: 0.0.0.0" - else - VERSIONSTRING=$version - echo "Version set to: $VERSIONSTRING" - fi - - if [[ "$configuration" == "" ]]; then - CONFIGURATION="Release" - echo "Configuration defaulted to: $CONFIGURATION" - else - if [[ "$configuration" == "Release" || "$configuration" == "Debug" ]]; then - CONFIGURATION=$configuration - echo "Configuration set to: $CONFIGURATION" - else - echo "Invalid configuration: $configuration" - usage - fi - fi -} - -function revertVersionInfo() { - files=$( find . -name "VersionInfo.cs" ) - - for file in $files - do - git checkout "$file" - echo "Reverted $file" - done -} - -function err() { - revertVersionInfo - echo "FAILED. See earlier messages" - exit 1 -} - -function patchVersionInfo { - branchName=$(git rev-parse --abbrev-ref HEAD) - commitHash=$(git log -n1 --pretty=format:"%H" HEAD) - commitTimestamp=$(git log -n1 --pretty=format:"%aD" HEAD) - - newVersion="public static readonly string Version = \"$VERSIONSTRING\";" - newBranch="public static readonly string Branch = \"$branchName\";" - newCommitHash="public static readonly string Hashtag = \"$commitHash\";" - newTimestamp="public static readonly string Timestamp = \"$commitTimestamp\";" - - versionPattern="public static readonly string Version .*$" - branchPattern="public static readonly string Branch .*$" - commitHashPattern="public static readonly string Hashtag .*$" - timestampPattern="public static readonly string Timestamp .*$" - - files=$( find . -name "VersionInfo.cs" ) - - for file in $files - do - tempfile="$file.tmp" - sed -e "s/$versionPattern/$newVersion/" \ - -e "s/$branchPattern/$newBranch/" \ - -e "s/$commitHashPattern/$newCommitHash/" \ - -e "s/$timestampPattern/$newTimestamp/" \ - "$file" > "$tempfile" - - mv "$tempfile" "$file" - echo "Patched $file with version information" - done -} - -function buildKurrentDB { - patchVersionInfo - rm -rf bin/ - dotnet build -c $CONFIGURATION /p:Platform=x64 /p:Version=$VERSIONSTRING --framework=$NET_FRAMEWORK src/KurrentDB.sln || err - revertVersionInfo -} - -function exitWithError { - echo "$1" - exit 1 -} - -detectOS -checkParams "$1" "$2" - -echo "Running from base directory: $BASE_DIR" -buildKurrentDB diff --git a/docs/server/quick-start/installation.md b/docs/server/quick-start/installation.md index bd3e2d7b433..81d8d4d8b75 100644 --- a/docs/server/quick-start/installation.md +++ b/docs/server/quick-start/installation.md @@ -426,7 +426,7 @@ KurrentDB can be deployed and managed using the [Operator](/server/kubernetes-op ## Building from source -You can also build [KurrentDB from source](https://github.com/EventStore/EventStore?tab=readme-ov-file#building-kurrentdb). Before doing that, you need to install the .NET 8 SDK. KurrentDB packages have the .NET Runtime embedded, so you don't need to install anything except the KurrentDB package. +You can also build [KurrentDB from source](https://github.com/EventStore/EventStore?tab=readme-ov-file#building-kurrentdb). Before doing that, you need to install the .NET 10 SDK. KurrentDB packages have the .NET Runtime embedded, so you don't need to install anything except the KurrentDB package. ## Compatibility notes diff --git a/src/Connectors/KurrentDB.Connectors.Contracts/KurrentDB.Connectors.Contracts.csproj b/src/Connectors/KurrentDB.Connectors.Contracts/KurrentDB.Connectors.Contracts.csproj index 13018b94dd4..e6351285d34 100644 --- a/src/Connectors/KurrentDB.Connectors.Contracts/KurrentDB.Connectors.Contracts.csproj +++ b/src/Connectors/KurrentDB.Connectors.Contracts/KurrentDB.Connectors.Contracts.csproj @@ -1,9 +1,7 @@ - net8.0 enable true - preview false true true diff --git a/src/Connectors/KurrentDB.Connectors.TestServer/KurrentDB.Connectors.TestServer.csproj b/src/Connectors/KurrentDB.Connectors.TestServer/KurrentDB.Connectors.TestServer.csproj index c2a93a36fcd..f3043770597 100644 --- a/src/Connectors/KurrentDB.Connectors.TestServer/KurrentDB.Connectors.TestServer.csproj +++ b/src/Connectors/KurrentDB.Connectors.TestServer/KurrentDB.Connectors.TestServer.csproj @@ -1,6 +1,5 @@  - net8.0 Exe enable enable diff --git a/src/Connectors/KurrentDB.Connectors.Tests/KurrentDB.Connectors.Tests.csproj b/src/Connectors/KurrentDB.Connectors.Tests/KurrentDB.Connectors.Tests.csproj index e4a80014217..b738ddab75e 100644 --- a/src/Connectors/KurrentDB.Connectors.Tests/KurrentDB.Connectors.Tests.csproj +++ b/src/Connectors/KurrentDB.Connectors.Tests/KurrentDB.Connectors.Tests.csproj @@ -1,6 +1,5 @@ - net8.0 enable enable xUnit1041 diff --git a/src/Connectors/KurrentDB.Connectors/KurrentDB.Connectors.csproj b/src/Connectors/KurrentDB.Connectors/KurrentDB.Connectors.csproj index e622421b1c6..ed0be6c794c 100644 --- a/src/Connectors/KurrentDB.Connectors/KurrentDB.Connectors.csproj +++ b/src/Connectors/KurrentDB.Connectors/KurrentDB.Connectors.csproj @@ -1,9 +1,7 @@ - net8.0 enable true - preview false true true @@ -57,6 +55,9 @@ + + compile + diff --git a/src/Connectors/KurrentDB.Connectors/Planes/Management/Queries/ConnectorQueries.cs b/src/Connectors/KurrentDB.Connectors/Planes/Management/Queries/ConnectorQueries.cs index 5bf388a03a2..a3b061bd29a 100644 --- a/src/Connectors/KurrentDB.Connectors/Planes/Management/Queries/ConnectorQueries.cs +++ b/src/Connectors/KurrentDB.Connectors/Planes/Management/Queries/ConnectorQueries.cs @@ -40,8 +40,8 @@ public async Task List(ListConnectors query, CancellationT .Where(Filter()) .Skip(skip) .Take(query.Paging.PageSize) - .SelectAwaitWithCancellation(Map(query, cancellationToken)) - .SelectAwaitWithCancellation(EnrichWithPosition()) + .Select(Map(query, cancellationToken)) + .Select(EnrichWithPosition()) .ToListAsync(cancellationToken); return new ListConnectorsResult { diff --git a/src/Connectors/KurrentDB.Plugins.Connectors/.run/KurrentDB (MemDb=false).run.xml b/src/Connectors/KurrentDB.Plugins.Connectors/.run/KurrentDB (MemDb=false).run.xml index 3b9f859e0ef..cd26bc6e9fa 100644 --- a/src/Connectors/KurrentDB.Plugins.Connectors/.run/KurrentDB (MemDb=false).run.xml +++ b/src/Connectors/KurrentDB.Plugins.Connectors/.run/KurrentDB (MemDb=false).run.xml @@ -1,6 +1,6 @@ - diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index f922402d882..eadf9fb4cd5 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -62,46 +62,42 @@ - - - - - - - + + + + + + + - + - - - + + - - - + + + - - + + - - - - + + - - + + - + - - - + + @@ -119,6 +115,8 @@ + + @@ -160,28 +158,15 @@ - - - - - + + - - - - - - - + + - - - - - @@ -189,7 +174,7 @@ - + diff --git a/src/KurrentDB.Api.V2.Tests/KurrentDB.Api.V2.Tests.csproj b/src/KurrentDB.Api.V2.Tests/KurrentDB.Api.V2.Tests.csproj index b6a7b378220..2faa3f4fa33 100644 --- a/src/KurrentDB.Api.V2.Tests/KurrentDB.Api.V2.Tests.csproj +++ b/src/KurrentDB.Api.V2.Tests/KurrentDB.Api.V2.Tests.csproj @@ -1,7 +1,6 @@ Exe - net8.0 enable enable false diff --git a/src/KurrentDB.Api.V2/KurrentDB.Api.V2.csproj b/src/KurrentDB.Api.V2/KurrentDB.Api.V2.csproj index e59ae319b11..7a86b92958b 100644 --- a/src/KurrentDB.Api.V2/KurrentDB.Api.V2.csproj +++ b/src/KurrentDB.Api.V2/KurrentDB.Api.V2.csproj @@ -1,7 +1,5 @@  - net8.0 - preview enable enable KurrentDB.Api @@ -17,6 +15,9 @@ + + compile + diff --git a/src/KurrentDB.Auth.Ldaps.Tests/KurrentDB.Auth.Ldaps.Tests.csproj b/src/KurrentDB.Auth.Ldaps.Tests/KurrentDB.Auth.Ldaps.Tests.csproj index e82b00a919a..8d209716d71 100644 --- a/src/KurrentDB.Auth.Ldaps.Tests/KurrentDB.Auth.Ldaps.Tests.csproj +++ b/src/KurrentDB.Auth.Ldaps.Tests/KurrentDB.Auth.Ldaps.Tests.csproj @@ -1,7 +1,6 @@ - net8.0 false false true diff --git a/src/KurrentDB.Auth.Ldaps/KurrentDB.Auth.Ldaps.csproj b/src/KurrentDB.Auth.Ldaps/KurrentDB.Auth.Ldaps.csproj index a11a71faef7..f370188a604 100644 --- a/src/KurrentDB.Auth.Ldaps/KurrentDB.Auth.Ldaps.csproj +++ b/src/KurrentDB.Auth.Ldaps/KurrentDB.Auth.Ldaps.csproj @@ -1,7 +1,6 @@ - net8.0 Library true false diff --git a/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests.csproj b/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests.csproj index 1cd6f3ef482..4234cbd6fde 100644 --- a/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests.csproj +++ b/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.Tests.csproj @@ -1,7 +1,6 @@ - net8.0 Library true false diff --git a/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.csproj b/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.csproj index f737a596a30..6cdd197ac5c 100644 --- a/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.csproj +++ b/src/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled/KurrentDB.Auth.LegacyAuthorizationWithStreamAuthorizationDisabled.csproj @@ -1,7 +1,6 @@ - net8.0 Library true false diff --git a/src/KurrentDB.Auth.OAuth.Tests/KurrentDB.Auth.OAuth.Tests.csproj b/src/KurrentDB.Auth.OAuth.Tests/KurrentDB.Auth.OAuth.Tests.csproj index 1e09653422c..b2d5766a99e 100644 --- a/src/KurrentDB.Auth.OAuth.Tests/KurrentDB.Auth.OAuth.Tests.csproj +++ b/src/KurrentDB.Auth.OAuth.Tests/KurrentDB.Auth.OAuth.Tests.csproj @@ -1,7 +1,6 @@ - net8.0 Library true false @@ -19,6 +18,9 @@ + + compile + all diff --git a/src/KurrentDB.Auth.OAuth/KurrentDB.Auth.OAuth.csproj b/src/KurrentDB.Auth.OAuth/KurrentDB.Auth.OAuth.csproj index c34dd34cf17..b23c14f2a3a 100644 --- a/src/KurrentDB.Auth.OAuth/KurrentDB.Auth.OAuth.csproj +++ b/src/KurrentDB.Auth.OAuth/KurrentDB.Auth.OAuth.csproj @@ -1,7 +1,6 @@ - net8.0 Library true false diff --git a/src/KurrentDB.Auth.StreamPolicyPlugin.Tests/KurrentDB.Auth.StreamPolicyPlugin.Tests.csproj b/src/KurrentDB.Auth.StreamPolicyPlugin.Tests/KurrentDB.Auth.StreamPolicyPlugin.Tests.csproj index 2d51334ab0e..845d789631c 100644 --- a/src/KurrentDB.Auth.StreamPolicyPlugin.Tests/KurrentDB.Auth.StreamPolicyPlugin.Tests.csproj +++ b/src/KurrentDB.Auth.StreamPolicyPlugin.Tests/KurrentDB.Auth.StreamPolicyPlugin.Tests.csproj @@ -1,7 +1,6 @@ - net8.0 enable enable diff --git a/src/KurrentDB.Auth.StreamPolicyPlugin/KurrentDB.Auth.StreamPolicyPlugin.csproj b/src/KurrentDB.Auth.StreamPolicyPlugin/KurrentDB.Auth.StreamPolicyPlugin.csproj index b1cf828b8d8..c6a61d78a58 100644 --- a/src/KurrentDB.Auth.StreamPolicyPlugin/KurrentDB.Auth.StreamPolicyPlugin.csproj +++ b/src/KurrentDB.Auth.StreamPolicyPlugin/KurrentDB.Auth.StreamPolicyPlugin.csproj @@ -1,6 +1,5 @@ - net8.0 enable enable true diff --git a/src/KurrentDB.Auth.UserCertificates.Tests/KurrentDB.Auth.UserCertificates.Tests.csproj b/src/KurrentDB.Auth.UserCertificates.Tests/KurrentDB.Auth.UserCertificates.Tests.csproj index 84dd1e03de1..b3b08918ee0 100644 --- a/src/KurrentDB.Auth.UserCertificates.Tests/KurrentDB.Auth.UserCertificates.Tests.csproj +++ b/src/KurrentDB.Auth.UserCertificates.Tests/KurrentDB.Auth.UserCertificates.Tests.csproj @@ -1,7 +1,6 @@ - net8.0 enable enable false diff --git a/src/KurrentDB.Auth.UserCertificates/KurrentDB.Auth.UserCertificates.csproj b/src/KurrentDB.Auth.UserCertificates/KurrentDB.Auth.UserCertificates.csproj index 73e52364619..520bd7c4bd2 100644 --- a/src/KurrentDB.Auth.UserCertificates/KurrentDB.Auth.UserCertificates.csproj +++ b/src/KurrentDB.Auth.UserCertificates/KurrentDB.Auth.UserCertificates.csproj @@ -1,6 +1,5 @@ - net8.0 Library true false diff --git a/src/KurrentDB.AutoScavenge.Tests/KurrentDB.AutoScavenge.Tests.csproj b/src/KurrentDB.AutoScavenge.Tests/KurrentDB.AutoScavenge.Tests.csproj index 89556c32c96..9711fffeb96 100644 --- a/src/KurrentDB.AutoScavenge.Tests/KurrentDB.AutoScavenge.Tests.csproj +++ b/src/KurrentDB.AutoScavenge.Tests/KurrentDB.AutoScavenge.Tests.csproj @@ -1,7 +1,6 @@ - net8.0 enable enable @@ -15,6 +14,9 @@ + + compile + all diff --git a/src/KurrentDB.AutoScavenge/KurrentDB.AutoScavenge.csproj b/src/KurrentDB.AutoScavenge/KurrentDB.AutoScavenge.csproj index 8bdc6b718e0..965cb6a10e4 100644 --- a/src/KurrentDB.AutoScavenge/KurrentDB.AutoScavenge.csproj +++ b/src/KurrentDB.AutoScavenge/KurrentDB.AutoScavenge.csproj @@ -1,7 +1,6 @@ - net8.0 enable enable true diff --git a/src/KurrentDB.BufferManagement.Tests/BufferPoolStreamTests.cs b/src/KurrentDB.BufferManagement.Tests/BufferPoolStreamTests.cs index 24a3b074127..fc5863a15e9 100644 --- a/src/KurrentDB.BufferManagement.Tests/BufferPoolStreamTests.cs +++ b/src/KurrentDB.BufferManagement.Tests/BufferPoolStreamTests.cs @@ -39,7 +39,7 @@ public void position_is_incremented() { stream.Write(new byte[500], 0, 500); stream.Seek(0, SeekOrigin.Begin); Assert.AreEqual(0, stream.Position); - stream.Read(new byte[50], 0, 50); + stream.ReadExactly(new byte[50], 0, 50); Assert.AreEqual(50, stream.Position); } diff --git a/src/KurrentDB.Common.Tests/KurrentDB.Common.Tests.csproj b/src/KurrentDB.Common.Tests/KurrentDB.Common.Tests.csproj index 36e1944f926..6a98320669e 100644 --- a/src/KurrentDB.Common.Tests/KurrentDB.Common.Tests.csproj +++ b/src/KurrentDB.Common.Tests/KurrentDB.Common.Tests.csproj @@ -7,8 +7,6 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/KurrentDB.Common/KurrentDB.Common.csproj b/src/KurrentDB.Common/KurrentDB.Common.csproj index 9851af98f7d..023290609a5 100644 --- a/src/KurrentDB.Common/KurrentDB.Common.csproj +++ b/src/KurrentDB.Common/KurrentDB.Common.csproj @@ -11,9 +11,6 @@ all runtime; build; native; contentfiles; analyzers - - - @@ -30,11 +27,7 @@ - - - - diff --git a/src/KurrentDB.Core.Tests/Caching/EventNumberCachedTests.cs b/src/KurrentDB.Core.Tests/Caching/EventNumberCachedTests.cs index f349f9db209..097faf77375 100644 --- a/src/KurrentDB.Core.Tests/Caching/EventNumberCachedTests.cs +++ b/src/KurrentDB.Core.Tests/Caching/EventNumberCachedTests.cs @@ -26,6 +26,7 @@ public void size_in_lru_cache_is_measured_correctly_with_string_key() { // initialize any underlying data structures (the dictionary in this case) lruCache.Put("test", new EventNumberCached(0, 0, null)); + lruCache.Put("test2", new EventNumberCached(0, 0, null)); var mem = MemUsage.Calculate(() => lruCache.Put(new string('x', 10), new EventNumberCached(10, 23, null))); @@ -45,6 +46,7 @@ public void size_in_lru_cache_is_measured_correctly_with_long_key() { // initialize any underlying data structures (the dictionary in this case) lruCache.Put(123, new EventNumberCached(0, 0, null)); + lruCache.Put(124, new EventNumberCached(0, 0, null)); var mem = MemUsage.Calculate(() => lruCache.Put(456, new EventNumberCached(10, 123, null))); diff --git a/src/KurrentDB.Core.Tests/FakePlugin/FakePlugin.csproj b/src/KurrentDB.Core.Tests/FakePlugin/FakePlugin.csproj index 291db711dd0..93bece40460 100644 --- a/src/KurrentDB.Core.Tests/FakePlugin/FakePlugin.csproj +++ b/src/KurrentDB.Core.Tests/FakePlugin/FakePlugin.csproj @@ -1,5 +1,5 @@ - net8.0 + net10.0 diff --git a/src/KurrentDB.Core.Tests/Http/HttpProtocols/clear_text_http_multiplexing_middleware.cs b/src/KurrentDB.Core.Tests/Http/HttpProtocols/clear_text_http_multiplexing_middleware.cs index 5dd7f6d7e66..42f513b433c 100644 --- a/src/KurrentDB.Core.Tests/Http/HttpProtocols/clear_text_http_multiplexing_middleware.cs +++ b/src/KurrentDB.Core.Tests/Http/HttpProtocols/clear_text_http_multiplexing_middleware.cs @@ -9,7 +9,6 @@ using KurrentDB.Core.Services.Transport.Http; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; @@ -34,27 +33,28 @@ public void Configure(IApplicationBuilder app) { [TestFixture] public class clear_text_http_multiplexing_middleware { - private IWebHost _host; + private WebApplication _host; private string _endpoint; [SetUp] - public void SetUp() { - _host = new WebHostBuilder() - .UseKestrel(server => { - server.Listen(IPAddress.Loopback, 0, listenOptions => { - listenOptions.Use(next => new ClearTextHttpMultiplexingMiddleware(next).OnConnectAsync); - }); - }) - .UseStartup(new Startup()) - .Build(); - - _host.Start(); - _endpoint = _host.ServerFeatures.Get().Addresses.Single(); + public async Task SetUp() { + var startup = new Startup(); + var builder = WebApplication.CreateBuilder(); + builder.WebHost.UseKestrel(server => { + server.Listen(IPAddress.Loopback, 0, listenOptions => { + listenOptions.Use(next => new ClearTextHttpMultiplexingMiddleware(next).OnConnectAsync); + }); + }); + startup.ConfigureServices(builder.Services); + _host = builder.Build(); + startup.Configure(_host); + await _host.StartAsync(); + _endpoint = _host.Urls.First(); } [TearDown] public Task Teardown() { - _host?.Dispose(); + _host?.StopAsync(); return Task.CompletedTask; } diff --git a/src/KurrentDB.Core.Tests/KurrentDB.Core.Tests.csproj b/src/KurrentDB.Core.Tests/KurrentDB.Core.Tests.csproj index 4fe440b7a8a..a070d6be3d3 100644 --- a/src/KurrentDB.Core.Tests/KurrentDB.Core.Tests.csproj +++ b/src/KurrentDB.Core.Tests/KurrentDB.Core.Tests.csproj @@ -10,7 +10,6 @@ - @@ -23,6 +22,9 @@ + + compile + diff --git a/src/KurrentDB.Core.Tests/TestsInitFixture.cs b/src/KurrentDB.Core.Tests/TestsInitFixture.cs index 0334a1c653a..a9fb26806a0 100644 --- a/src/KurrentDB.Core.Tests/TestsInitFixture.cs +++ b/src/KurrentDB.Core.Tests/TestsInitFixture.cs @@ -15,7 +15,6 @@ namespace KurrentDB.Core.Tests; public class TestsInitFixture { [OneTimeSetUp] public void SetUp() { - ServicePointManager.DefaultConnectionLimit = 1000; LogEnvironmentInfo(); } diff --git a/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_completed_chunk.cs b/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_completed_chunk.cs index f3f879438e0..b5b8fac376a 100644 --- a/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_completed_chunk.cs +++ b/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_completed_chunk.cs @@ -90,7 +90,7 @@ public void contents_of_first_chunk_should_be_untouched() { var contents = new byte[_config.ChunkSize]; using (var fs = File.OpenRead(GetFilePathFor("chunk-000000.000001"))) { fs.Position = ChunkHeader.Size; - fs.Read(contents, 0, contents.Length); + fs.ReadExactly(contents, 0, contents.Length); Assert.AreEqual(_file1Contents, contents); } } @@ -106,14 +106,14 @@ public void ongoing_chunk_should_have_full_size_and_filled_with_zeros_after_writ var shouldBeZeros = new byte[_config.ChunkSize - leftDataSize + ChunkFooter.Size]; fs.Position = ChunkHeader.Size; - fs.Read(leftData, 0, leftData.Length); + fs.ReadExactly(leftData, 0, leftData.Length); var shouldBeLeft = new byte[leftDataSize]; Buffer.BlockCopy(_file2Contents, 0, shouldBeLeft, 0, leftDataSize); Assert.AreEqual(shouldBeLeft, leftData); fs.Position = ChunkHeader.Size + _config.WriterCheckpoint.Read() % _config.ChunkSize; - fs.Read(shouldBeZeros, 0, shouldBeZeros.Length); + fs.ReadExactly(shouldBeZeros, 0, shouldBeZeros.Length); Assert.IsTrue(shouldBeZeros.All(x => x == 0), "Chunk is not zeroed."); } diff --git a/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_ongoing_chunk.cs b/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_ongoing_chunk.cs index addcd4eca5f..c60f21ce40c 100644 --- a/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_ongoing_chunk.cs +++ b/src/KurrentDB.Core.Tests/TransactionLog/Truncation/when_truncating_into_the_middle_of_ongoing_chunk.cs @@ -88,7 +88,7 @@ public void contents_of_first_chunk_should_be_untouched() { var contents = new byte[_config.ChunkSize]; using (var fs = File.OpenRead(GetFilePathFor("chunk-000000.000001"))) { fs.Position = ChunkHeader.Size; - fs.Read(contents, 0, contents.Length); + fs.ReadExactly(contents, 0, contents.Length); Assert.AreEqual(_file1Contents, contents); } } @@ -104,14 +104,14 @@ public void ongoing_chunk_should_have_full_size_and_filled_with_zeros_after_writ var shouldBeZeros = new byte[_config.ChunkSize - leftDataSize + ChunkFooter.Size]; fs.Position = ChunkHeader.Size; - fs.Read(leftData, 0, leftData.Length); + fs.ReadExactly(leftData, 0, leftData.Length); var shouldBeLeft = new byte[leftDataSize]; Buffer.BlockCopy(_file2Contents, 0, shouldBeLeft, 0, leftDataSize); Assert.AreEqual(shouldBeLeft, leftData); fs.Position = ChunkHeader.Size + _config.WriterCheckpoint.Read() % _config.ChunkSize; - fs.Read(shouldBeZeros, 0, shouldBeZeros.Length); + fs.ReadExactly(shouldBeZeros, 0, shouldBeZeros.Length); Assert.IsTrue(shouldBeZeros.All(x => x == 0), "Chunk is not zeroed!"); } diff --git a/src/KurrentDB.Core.Tests/TransactionLog/Unbuffered/UnbufferedTests.cs b/src/KurrentDB.Core.Tests/TransactionLog/Unbuffered/UnbufferedTests.cs index d4d5c0c3808..fa19e9f8ef5 100644 --- a/src/KurrentDB.Core.Tests/TransactionLog/Unbuffered/UnbufferedTests.cs +++ b/src/KurrentDB.Core.Tests/TransactionLog/Unbuffered/UnbufferedTests.cs @@ -348,7 +348,7 @@ public void when_seeking_non_exact_to_zero_block_and_writing() { using (var stream = new FileStream(filename, FileMode.Open)) { var read = new byte[128]; - stream.Read(read, 0, 128); + stream.ReadExactly(read, 0, 128); for (var i = 0; i < read.Length; i++) { Assert.AreEqual(i, read[i]); } @@ -387,9 +387,9 @@ public void when_reading_multiple_times() { FileShare.ReadWrite, 4096, 4096, false, 4096)) { stream.Seek(4096 + 15, SeekOrigin.Begin); var read = new byte[1000]; - stream.Read(read, 0, 500); + stream.ReadExactly(read, 0, 500); Assert.AreEqual(4096 + 15 + 500, stream.Position); - stream.Read(read, 500, 500); + stream.ReadExactly(read, 500, 500); Assert.AreEqual(4096 + 15 + 1000, stream.Position); for (var i = 0; i < read.Length; i++) { Assert.AreEqual((i + 15) % 256, read[i]); @@ -404,9 +404,9 @@ public void when_reading_multiple_times_no_seek() { using (var stream = UnbufferedFileStream.Create(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, 4096, 4096, false, 4096)) { var read = new byte[1000]; - stream.Read(read, 0, 500); + stream.ReadExactly(read, 0, 500); Assert.AreEqual(500, stream.Position); - stream.Read(read, 500, 500); + stream.ReadExactly(read, 500, 500); Assert.AreEqual(1000, stream.Position); for (var i = 0; i < read.Length; i++) { Assert.AreEqual(i % 256, read[i]); @@ -421,7 +421,7 @@ public void when_reading_multiple_times_over_page_size() { using (var stream = UnbufferedFileStream.Create(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, 4096, 4096, false, 4096)) { var read = new byte[6000]; - stream.Read(read, 0, 3000); + stream.ReadExactly(read, 0, 3000); Assert.AreEqual(3000, stream.Position); var total = stream.Read(read, 3000, 3000); Assert.AreEqual(3000, total); @@ -439,7 +439,7 @@ public void when_reading_multiple_times_on_page_size() { using (var stream = UnbufferedFileStream.Create(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, 4096, 4096, false, 4096)) { var read = new byte[6000]; - stream.Read(read, 0, 3000); + stream.ReadExactly(read, 0, 3000); Assert.AreEqual(3000, stream.Position); var total = stream.Read(read, 3000, 1096); Assert.AreEqual(1096, total); @@ -532,7 +532,7 @@ public void when_reading_on_aligned_buffer() { using (var stream = UnbufferedFileStream.Create(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, 4096, 4096, false, 4096)) { var read = new byte[4096]; - stream.Read(read, 0, 4096); + stream.ReadExactly(read, 0, 4096); for (var i = 0; i < 4096; i++) { Assert.AreEqual(i % 256, read[i]); } @@ -547,7 +547,7 @@ public void when_reading_on_unaligned_buffer() { FileShare.ReadWrite, 4096, 4096, false, 4096)) { stream.Seek(15, SeekOrigin.Begin); var read = new byte[999]; - stream.Read(read, 0, read.Length); + stream.ReadExactly(read, 0, read.Length); for (var i = 0; i < read.Length; i++) { Assert.AreEqual((i + 15) % 256, read[i]); } @@ -563,7 +563,7 @@ public void seek_and_read_on_unaligned_buffer() { stream.Seek(4096 + 15, SeekOrigin.Begin); Assert.AreEqual(4096 + 15, stream.Position); var read = new byte[999]; - stream.Read(read, 0, read.Length); + stream.ReadExactly(read, 0, read.Length); Assert.AreEqual(4096 + 15 + 999, stream.Position); for (var i = 0; i < read.Length; i++) { Assert.AreEqual((i + 15) % 256, read[i]); @@ -615,7 +615,7 @@ public void seek_write_seek_read_in_buffer() { stream.Write(buffer, 0, buffer.Length); stream.Seek(4096 + 15, SeekOrigin.Begin); var read = new byte[255]; - stream.Read(read, 0, read.Length); + stream.ReadExactly(read, 0, read.Length); for (var i = 0; i < read.Length; i++) { Assert.AreEqual(i % 255, read[i]); } @@ -685,7 +685,7 @@ private byte[] BuildBytes(int count) { private byte[] ReadAllBytesShared(string filename) { using (var fs = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { var ret = new byte[fs.Length]; - fs.Read(ret, 0, (int)fs.Length); + fs.ReadExactly(ret, 0, (int)fs.Length); return ret; } } diff --git a/src/KurrentDB.Core.Tests/mono_filestream_bug.cs b/src/KurrentDB.Core.Tests/mono_filestream_bug.cs index b29ce571067..51b62a6585e 100644 --- a/src/KurrentDB.Core.Tests/mono_filestream_bug.cs +++ b/src/KurrentDB.Core.Tests/mono_filestream_bug.cs @@ -18,7 +18,8 @@ public void when_validating_a_uri_template_with_url_encoded_chars() { } } - +// TODO: we no longer support mono and can remove this test, but we can also remove whatever production code change +// this test is ensuring too. [TestFixture, Ignore("Known bug in Mono, waiting for fix.")] public class mono_filestream_bug { [Test] @@ -34,7 +35,7 @@ public void show_time() { using (var file = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.Read, bufferSize, FileOptions.SequentialScan)) { - file.Read(new byte[pos], 0, pos); // THIS READ IS CRITICAL, WITHOUT IT EVERYTHING WORKS + file.ReadExactly(new byte[pos], 0, pos); // THIS READ IS CRITICAL, WITHOUT IT EVERYTHING WORKS Assert.AreEqual(pos, file.Position); // !!! here it says position is correct, but writes at different position !!! // file.Position = pos; // !!! this fixes test !!! @@ -46,7 +47,7 @@ public void show_time() { using (var filestream = File.Open(filename, FileMode.Open, FileAccess.Read)) { var bb = new byte[bytes.Length]; filestream.Position = pos; - filestream.Read(bb, 0, bb.Length); + filestream.ReadExactly(bb, 0, bb.Length); Assert.AreEqual(bytes, bb); } } diff --git a/src/KurrentDB.Core.XUnit.Tests/Configuration/ClusterVNodeOptionsTests.cs b/src/KurrentDB.Core.XUnit.Tests/Configuration/ClusterVNodeOptionsTests.cs index 859049c99d4..9024962f67c 100644 --- a/src/KurrentDB.Core.XUnit.Tests/Configuration/ClusterVNodeOptionsTests.cs +++ b/src/KurrentDB.Core.XUnit.Tests/Configuration/ClusterVNodeOptionsTests.cs @@ -234,7 +234,7 @@ public void reports_gossip_seed_errors(bool useEventStorePrefix, string gossipSe ClusterVNodeOptions.FromConfiguration(config)); Assert.Equal( - $"Failed to convert configuration value at '{KurrentPrefix}:GossipSeed' to type 'System.Net.EndPoint[]'. " + expectedError, + $"Failed to convert configuration value '{gossipSeed}' at '{KurrentPrefix}:GossipSeed' to type 'System.Net.EndPoint[]'. " + expectedError, ex.Message); } @@ -253,7 +253,7 @@ public void reports_ip_address_errors(bool useEventStorePrefix, string nodeIp, s ClusterVNodeOptions.FromConfiguration(config)); Assert.Equal( - $"Failed to convert configuration value at '{KurrentPrefix}:NodeIp' to type 'System.Net.IPAddress'. " + expectedError, + $"Failed to convert configuration value '{nodeIp}' at '{KurrentPrefix}:NodeIp' to type 'System.Net.IPAddress'. " + expectedError, ex.Message); } diff --git a/src/KurrentDB.Core.XUnit.Tests/KurrentDB.Core.XUnit.Tests.csproj b/src/KurrentDB.Core.XUnit.Tests/KurrentDB.Core.XUnit.Tests.csproj index b03a8afcf33..43b07ca149d 100644 --- a/src/KurrentDB.Core.XUnit.Tests/KurrentDB.Core.XUnit.Tests.csproj +++ b/src/KurrentDB.Core.XUnit.Tests/KurrentDB.Core.XUnit.Tests.csproj @@ -8,7 +8,6 @@ - @@ -21,6 +20,9 @@ all + + compile + diff --git a/src/KurrentDB.Core.XUnit.Tests/PluginLoaderTests.cs b/src/KurrentDB.Core.XUnit.Tests/PluginLoaderTests.cs index 415c065c685..d3df099fe17 100644 --- a/src/KurrentDB.Core.XUnit.Tests/PluginLoaderTests.cs +++ b/src/KurrentDB.Core.XUnit.Tests/PluginLoaderTests.cs @@ -90,7 +90,7 @@ private static async Task BuildFakePlugin(DirectoryInfo outputFolder) { using var process = new Process { StartInfo = new ProcessStartInfo { FileName = "dotnet", - Arguments = $"publish --configuration {BuildConfiguration} --framework=net8.0 --output {outputFolder.FullName}", + Arguments = $"publish --configuration {BuildConfiguration} --framework=net10.0 --output {outputFolder.FullName}", WorkingDirectory = PluginSourceDirectory, UseShellExecute = false, RedirectStandardError = true, diff --git a/src/KurrentDB.Core.XUnit.Tests/TransactionLog/Chunks/TFChunkManagerTests.cs b/src/KurrentDB.Core.XUnit.Tests/TransactionLog/Chunks/TFChunkManagerTests.cs index bbe117936d4..4962dc38fc0 100644 --- a/src/KurrentDB.Core.XUnit.Tests/TransactionLog/Chunks/TFChunkManagerTests.cs +++ b/src/KurrentDB.Core.XUnit.Tests/TransactionLog/Chunks/TFChunkManagerTests.cs @@ -70,7 +70,7 @@ async ValueTask CreateNewChunk(int start, int end) { IAsyncEnumerable ActualChunks => Enumerable .Range(0, _sut.ChunksCount) .ToAsyncEnumerable() - .SelectAwaitWithCancellation(async (chunkNum, ct) => (await _sut.GetInitializedChunk(chunkNum, ct)).ChunkLocator); + .Select(async (chunkNum, ct) => (await _sut.GetInitializedChunk(chunkNum, ct)).ChunkLocator); [Theory] [InlineData(1, 4, "too big")] diff --git a/src/KurrentDB.Core/Bus/Extensions/PublisherSubscribeExtensions.cs b/src/KurrentDB.Core/Bus/Extensions/PublisherSubscribeExtensions.cs index fbd022e85b6..23f31b657ac 100644 --- a/src/KurrentDB.Core/Bus/Extensions/PublisherSubscribeExtensions.cs +++ b/src/KurrentDB.Core/Bus/Extensions/PublisherSubscribeExtensions.cs @@ -38,7 +38,7 @@ static async IAsyncEnumerable SubscribeToAll(this IPublisher publi ); while (!cancellationToken.IsCancellationRequested) { - if (!await sub.MoveNextAsync(cancellationToken)) + if (!await sub.MoveNextAsync()) break; yield return sub.Current; @@ -84,7 +84,7 @@ public static async IAsyncEnumerable SubscribeToIndex(this IPublis ); while (!cancellationToken.IsCancellationRequested) { - if (!await sub.MoveNextAsync(cancellationToken)) + if (!await sub.MoveNextAsync()) break; yield return sub.Current; diff --git a/src/KurrentDB.Core/Index/PTable.cs b/src/KurrentDB.Core/Index/PTable.cs index fcc93faf37e..a6d82985ab6 100644 --- a/src/KurrentDB.Core/Index/PTable.cs +++ b/src/KurrentDB.Core/Index/PTable.cs @@ -842,12 +842,12 @@ private Range LocateRecordRange(IndexEntryKey lowKey, IndexEntryKey highKey, out lowKeyOut = new IndexEntryKey(ulong.MaxValue, long.MaxValue); highKeyOut = new IndexEntryKey(ulong.MinValue, long.MinValue); - ReadOnlySpan midpoints = null; + ReadOnlySpan midpoints = default; if (_midpoints != null) { midpoints = _midpoints.AsSpan(); } - if (midpoints == null) + if (midpoints.IsEmpty) return new Range(0, Count - 1); long lowerMidpoint = LowerMidpointBound(midpoints, lowKey); diff --git a/src/KurrentDB.Core/Index/PTableConstruction.cs b/src/KurrentDB.Core/Index/PTableConstruction.cs index f7755d81b54..995e53838c8 100644 --- a/src/KurrentDB.Core/Index/PTableConstruction.cs +++ b/src/KurrentDB.Core/Index/PTableConstruction.cs @@ -604,7 +604,7 @@ private static void ComputeMidpoints(BufferedStream bs, FileStream fs, byte vers midpoints.Add(new Midpoint(previousKey, previousIndex)); } else { fs.Seek(PTableHeader.Size + index * indexEntrySize, SeekOrigin.Begin); - fs.Read(buffer, 0, indexKeySize); + fs.ReadExactly(buffer, 0, indexKeySize); IndexEntryKey key = new IndexEntryKey(BitConverter.ToUInt64(buffer, 8), BitConverter.ToInt64(buffer, 0)); midpoints.Add(new Midpoint(key, index)); diff --git a/src/KurrentDB.Core/KurrentDB.Core.csproj b/src/KurrentDB.Core/KurrentDB.Core.csproj index 9d02c0bdc51..b826b0b2ff8 100644 --- a/src/KurrentDB.Core/KurrentDB.Core.csproj +++ b/src/KurrentDB.Core/KurrentDB.Core.csproj @@ -1,4 +1,4 @@ - + true true @@ -28,19 +28,16 @@ - - - - + + compile + - - diff --git a/src/KurrentDB.Core/MetricsBootstrapper.cs b/src/KurrentDB.Core/MetricsBootstrapper.cs index 145ee44337f..ec4c7775158 100644 --- a/src/KurrentDB.Core/MetricsBootstrapper.cs +++ b/src/KurrentDB.Core/MetricsBootstrapper.cs @@ -40,7 +40,10 @@ public class GrpcTrackers { private readonly IDurationTracker[] _trackers; public GrpcTrackers() { - _trackers = new IDurationTracker[Enum.GetValues().Cast().Max() + 1]; + //qq temporarily workaround entrypointnotfound runtime bug that results from call to cast + // https://github.com/dotnet/runtime/issues/120270 + //_trackers = new IDurationTracker[Enum.GetValues().Cast().Max() + 1]; + _trackers = new IDurationTracker[Enum.GetValues().Select(x => (int)x).Max() + 1]; var noOp = new DurationTracker.NoOp(); for (var i = 0; i < _trackers.Length; i++) _trackers[i] = noOp; diff --git a/src/KurrentDB.Core/Services/Storage/ReaderIndex/IndexReader.cs b/src/KurrentDB.Core/Services/Storage/ReaderIndex/IndexReader.cs index 3fa85c9a3e4..9b348f25dd5 100644 --- a/src/KurrentDB.Core/Services/Storage/ReaderIndex/IndexReader.cs +++ b/src/KurrentDB.Core/Services/Storage/ReaderIndex/IndexReader.cs @@ -161,11 +161,11 @@ private ValueTask> ReadPrepare(TStreamId streamId, long eventNumber, CancellationToken token) { var recordsQuery = _tableIndex.GetRange(streamId, eventNumber, eventNumber) .ToAsyncEnumerable() - .SelectAwaitWithCancellation(async (x, token) => + .Select(async (x, token) => new { x.Version, Prepare = await ReadPrepareInternal(x.Position, token) }) .Where(x => x.Prepare is not null && StreamIdComparer.Equals(x.Prepare.EventStreamId, streamId)) .GroupBy(static x => x.Version) - .SelectAwaitWithCancellation(AsyncEnumerable.LastAsync) + .Select(Enumerable.Last) .Select(static x => x.Prepare); return recordsQuery.FirstOrDefaultAsync(token); @@ -266,17 +266,17 @@ private async ValueTask ReadStreamEventsForwardInternal(s var recordsQuery = _tableIndex.GetRange(streamId, startEventNumber, endEventNumber) .ToAsyncEnumerable() - .SelectAwaitWithCancellation(async (x, ct) => + .Select(async (x, ct) => new { x.Version, Prepare = await ReadPrepareInternal(x.Position, ct) }) .Where(x => x.Prepare != null && StreamIdComparer.Equals(x.Prepare.EventStreamId, streamId)); if (!skipIndexScanOnRead) { recordsQuery = recordsQuery.OrderByDescending(x => x.Version) - .GroupBy(static x => x.Version).SelectAwaitWithCancellation(AsyncEnumerable.LastAsync); + .GroupBy(static x => x.Version).Select(Enumerable.Last); } var records = await recordsQuery .Reverse() - .SelectAwaitWithCancellation((x, ct) => CreateEventRecord(x.Version, x.Prepare, streamName, ct)) + .Select((x, ct) => CreateEventRecord(x.Version, x.Prepare, streamName, ct)) .ToArrayAsync(token); long nextEventNumber = Math.Min(endEventNumber + 1, lastEventNumber + 1); @@ -483,7 +483,7 @@ private IAsyncEnumerable ReadIndexEntries_RemoveCollisions(IndexRead long endEventNumber) => indexReader._tableIndex.GetRange(streamHandle, startEventNumber, endEventNumber) .ToAsyncEnumerable() - .SelectAwaitWithCancellation(async (x, token) => new { IndexEntry = x, Prepare = await ReadPrepareInternal(x.Position, token) }) + .Select(async (x, token) => new { IndexEntry = x, Prepare = await ReadPrepareInternal(x.Position, token) }) .Where(x => x.Prepare is not null && StreamIdComparer.Equals(x.Prepare.EventStreamId, streamHandle)) .Select(static x => x.IndexEntry); @@ -614,13 +614,13 @@ private async ValueTask ReadStreamEventsBackwardInternal( var recordsQuery = _tableIndex.GetRange(streamId, startEventNumber, endEventNumber) .ToAsyncEnumerable() - .SelectAwaitWithCancellation(async (x, ct) => new { x.Version, Prepare = await ReadPrepareInternal(x.Position, ct) }) + .Select(async (x, ct) => new { x.Version, Prepare = await ReadPrepareInternal(x.Position, ct) }) .Where(x => x.Prepare is not null && StreamIdComparer.Equals(x.Prepare.EventStreamId, streamId)); if (!skipIndexScanOnRead) { recordsQuery = recordsQuery .OrderByDescending(static x => x.Version) .GroupBy(x => x.Version) - .SelectAwaitWithCancellation(AsyncEnumerable.LastAsync); + .Select(Enumerable.Last); } if (metadata.MaxAge.HasValue) { @@ -629,7 +629,7 @@ private async ValueTask ReadStreamEventsBackwardInternal( } var records = await recordsQuery - .SelectAwaitWithCancellation((x, ct) => CreateEventRecord(x.Version, x.Prepare, streamName, ct)) + .Select((x, ct) => CreateEventRecord(x.Version, x.Prepare, streamName, ct)) .ToArrayAsync(token); isEndOfStream = isEndOfStream diff --git a/src/KurrentDB.Core/Services/Transport/Grpc/Monitoring.cs b/src/KurrentDB.Core/Services/Transport/Grpc/Monitoring.cs index c536a6904ba..9e4b3e047dc 100644 --- a/src/KurrentDB.Core/Services/Transport/Grpc/Monitoring.cs +++ b/src/KurrentDB.Core/Services/Transport/Grpc/Monitoring.cs @@ -14,7 +14,7 @@ namespace KurrentDB.Core.Services.Transport.Grpc; internal class Monitoring(IPublisher publisher) : EventStore.Client.Monitoring.Monitoring.MonitoringBase { - public override Task Stats(StatsReq request, IServerStreamWriter responseStream, ServerCallContext context) { + public override async Task Stats(StatsReq request, IServerStreamWriter responseStream, ServerCallContext context) { var channel = Channel.CreateBounded(new BoundedChannelOptions(1) { SingleReader = true, SingleWriter = true @@ -22,8 +22,9 @@ public override Task Stats(StatsReq request, IServerStreamWriter resp _ = Receive(); - return channel.Reader.ReadAllAsync(context.CancellationToken) - .ForEachAwaitAsync(responseStream.WriteAsync, context.CancellationToken); + await foreach (var statsResponse in channel.Reader.ReadAllAsync(context.CancellationToken)) { + await responseStream.WriteAsync(statsResponse, context.CancellationToken); + } async Task Receive() { var delay = TimeSpan.FromMilliseconds(request.RefreshTimePeriodInMs); diff --git a/src/KurrentDB.Core/Services/Transport/Http/Authentication/Rfc2898PasswordHashAlgorithm.cs b/src/KurrentDB.Core/Services/Transport/Http/Authentication/Rfc2898PasswordHashAlgorithm.cs index effbce60af3..05bf9d566eb 100644 --- a/src/KurrentDB.Core/Services/Transport/Http/Authentication/Rfc2898PasswordHashAlgorithm.cs +++ b/src/KurrentDB.Core/Services/Transport/Http/Authentication/Rfc2898PasswordHashAlgorithm.cs @@ -15,8 +15,7 @@ public override void Hash(string password, out string hash, out string salt) { var saltData = new byte[SaltSize]; RandomNumberGenerator.Fill(saltData); - using var rfcBytes = new Rfc2898DeriveBytes(password, saltData, Iterations, HashAlgorithmName.SHA1); - var hashData = rfcBytes.GetBytes(HashSize); + var hashData = Rfc2898DeriveBytes.Pbkdf2(password, saltData, Iterations, HashAlgorithmName.SHA1, HashSize); hash = System.Convert.ToBase64String(hashData); salt = System.Convert.ToBase64String(saltData); } @@ -24,8 +23,8 @@ public override void Hash(string password, out string hash, out string salt) { public override bool Verify(string password, string hash, string salt) { var saltData = System.Convert.FromBase64String(salt); - using var rfcBytes = new Rfc2898DeriveBytes(password, saltData, Iterations, HashAlgorithmName.SHA1); - var newHash = System.Convert.ToBase64String(rfcBytes.GetBytes(HashSize)); + var bytes = Rfc2898DeriveBytes.Pbkdf2(password, saltData, Iterations, HashAlgorithmName.SHA1, HashSize); + var newHash = System.Convert.ToBase64String(bytes); return hash == newHash; } diff --git a/src/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests.csproj b/src/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests.csproj index bcca648d88a..0ce81d65c5e 100644 --- a/src/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests.csproj +++ b/src/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests/KurrentDB.Diagnostics.LogsEndpointPlugin.Tests.csproj @@ -1,6 +1,5 @@ - net8.0 enable enable false diff --git a/src/KurrentDB.Diagnostics.LogsEndpointPlugin/KurrentDB.Diagnostics.LogsEndpointPlugin.csproj b/src/KurrentDB.Diagnostics.LogsEndpointPlugin/KurrentDB.Diagnostics.LogsEndpointPlugin.csproj index ded0533a767..c7e6bfbd465 100644 --- a/src/KurrentDB.Diagnostics.LogsEndpointPlugin/KurrentDB.Diagnostics.LogsEndpointPlugin.csproj +++ b/src/KurrentDB.Diagnostics.LogsEndpointPlugin/KurrentDB.Diagnostics.LogsEndpointPlugin.csproj @@ -1,6 +1,5 @@ - net8.0 Library true false diff --git a/src/KurrentDB.LogV3.Tests/KurrentDB.LogV3.Tests.csproj b/src/KurrentDB.LogV3.Tests/KurrentDB.LogV3.Tests.csproj index 0dae7e37598..22c9bd65a85 100644 --- a/src/KurrentDB.LogV3.Tests/KurrentDB.LogV3.Tests.csproj +++ b/src/KurrentDB.LogV3.Tests/KurrentDB.LogV3.Tests.csproj @@ -1,4 +1,4 @@ - + true @@ -7,9 +7,6 @@ - - - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/KurrentDB.Logging/KurrentDB.Logging.csproj b/src/KurrentDB.Logging/KurrentDB.Logging.csproj index 23b589b9c63..cd4c4077ac1 100644 --- a/src/KurrentDB.Logging/KurrentDB.Logging.csproj +++ b/src/KurrentDB.Logging/KurrentDB.Logging.csproj @@ -1,7 +1,6 @@  - net8.0 enable enable diff --git a/src/KurrentDB.NETCore.Compatibility/KurrentDB.NETCore.Compatibility.csproj b/src/KurrentDB.NETCore.Compatibility/KurrentDB.NETCore.Compatibility.csproj index ba626c29f18..f815f0c8216 100644 --- a/src/KurrentDB.NETCore.Compatibility/KurrentDB.NETCore.Compatibility.csproj +++ b/src/KurrentDB.NETCore.Compatibility/KurrentDB.NETCore.Compatibility.csproj @@ -6,6 +6,5 @@ - diff --git a/src/KurrentDB.OtlpExporterPlugin.Tests/KurrentDB.OtlpExporterPlugin.Tests.csproj b/src/KurrentDB.OtlpExporterPlugin.Tests/KurrentDB.OtlpExporterPlugin.Tests.csproj index e3a1d34400b..080fb1aa136 100644 --- a/src/KurrentDB.OtlpExporterPlugin.Tests/KurrentDB.OtlpExporterPlugin.Tests.csproj +++ b/src/KurrentDB.OtlpExporterPlugin.Tests/KurrentDB.OtlpExporterPlugin.Tests.csproj @@ -15,8 +15,6 @@ runtime; build; native; contentfiles; analyzers - - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/KurrentDB.POC.ConnectedSubsystemsPlugin/KurrentDB.POC.ConnectedSubsystemsPlugin.csproj b/src/KurrentDB.POC.ConnectedSubsystemsPlugin/KurrentDB.POC.ConnectedSubsystemsPlugin.csproj index f8636dba7bf..732d62effa5 100644 --- a/src/KurrentDB.POC.ConnectedSubsystemsPlugin/KurrentDB.POC.ConnectedSubsystemsPlugin.csproj +++ b/src/KurrentDB.POC.ConnectedSubsystemsPlugin/KurrentDB.POC.ConnectedSubsystemsPlugin.csproj @@ -3,6 +3,11 @@ true enable + + + compile + + diff --git a/src/KurrentDB.Plugins.Api.V2/KurrentDB.Plugins.Api.V2.csproj b/src/KurrentDB.Plugins.Api.V2/KurrentDB.Plugins.Api.V2.csproj index b4ddf3b9592..2fdf9aba2f6 100644 --- a/src/KurrentDB.Plugins.Api.V2/KurrentDB.Plugins.Api.V2.csproj +++ b/src/KurrentDB.Plugins.Api.V2/KurrentDB.Plugins.Api.V2.csproj @@ -1,12 +1,10 @@  - net8.0 library true true enable true - preview false true true diff --git a/src/KurrentDB.Plugins/KurrentDB.Plugins.csproj b/src/KurrentDB.Plugins/KurrentDB.Plugins.csproj index b8b277fc058..55c343e2c5e 100644 --- a/src/KurrentDB.Plugins/KurrentDB.Plugins.csproj +++ b/src/KurrentDB.Plugins/KurrentDB.Plugins.csproj @@ -8,7 +8,6 @@ - diff --git a/src/KurrentDB.Projections.Core.XUnit.Tests/KurrentDB.Projections.Core.XUnit.Tests.csproj b/src/KurrentDB.Projections.Core.XUnit.Tests/KurrentDB.Projections.Core.XUnit.Tests.csproj index d6e21e52a5a..75388453177 100644 --- a/src/KurrentDB.Projections.Core.XUnit.Tests/KurrentDB.Projections.Core.XUnit.Tests.csproj +++ b/src/KurrentDB.Projections.Core.XUnit.Tests/KurrentDB.Projections.Core.XUnit.Tests.csproj @@ -1,7 +1,6 @@ - net8.0 enable enable diff --git a/src/KurrentDB.Projections.Core.XUnit.Tests/Metrics/ProjectionTrackerTests.cs b/src/KurrentDB.Projections.Core.XUnit.Tests/Metrics/ProjectionTrackerTests.cs index c20c80ee174..f5d34938d26 100644 --- a/src/KurrentDB.Projections.Core.XUnit.Tests/Metrics/ProjectionTrackerTests.cs +++ b/src/KurrentDB.Projections.Core.XUnit.Tests/Metrics/ProjectionTrackerTests.cs @@ -92,8 +92,6 @@ static Action> AssertMeasurement(T expectedValue, params KeyVa actualMeasurement => { Assert.Equal(expectedValue, actualMeasurement.Value); - if (actualMeasurement.Tags == null) - return; var actualTags = actualMeasurement.Tags.ToArray(); Assert.Equal(tags, actualTags!, (a, b) => a.Key == b.Key && a.Value.Equals(b.Value)); }; diff --git a/src/KurrentDB.SecondaryIndexing.LoadTesting/KurrentDB.SecondaryIndexing.LoadTesting.csproj b/src/KurrentDB.SecondaryIndexing.LoadTesting/KurrentDB.SecondaryIndexing.LoadTesting.csproj index ca4c4aea935..d4e9ee20ad9 100644 --- a/src/KurrentDB.SecondaryIndexing.LoadTesting/KurrentDB.SecondaryIndexing.LoadTesting.csproj +++ b/src/KurrentDB.SecondaryIndexing.LoadTesting/KurrentDB.SecondaryIndexing.LoadTesting.csproj @@ -2,7 +2,6 @@ Exe - net8.0 enable enable diff --git a/src/KurrentDB.SecondaryIndexing.Tests/KurrentDB.SecondaryIndexing.Tests.csproj b/src/KurrentDB.SecondaryIndexing.Tests/KurrentDB.SecondaryIndexing.Tests.csproj index 20cd49a5716..97e29219501 100644 --- a/src/KurrentDB.SecondaryIndexing.Tests/KurrentDB.SecondaryIndexing.Tests.csproj +++ b/src/KurrentDB.SecondaryIndexing.Tests/KurrentDB.SecondaryIndexing.Tests.csproj @@ -16,6 +16,9 @@ + + compile + all diff --git a/src/KurrentDB.SecondaryIndexing/KurrentDB.SecondaryIndexing.csproj b/src/KurrentDB.SecondaryIndexing/KurrentDB.SecondaryIndexing.csproj index 381e53b927a..0372ce52f07 100644 --- a/src/KurrentDB.SecondaryIndexing/KurrentDB.SecondaryIndexing.csproj +++ b/src/KurrentDB.SecondaryIndexing/KurrentDB.SecondaryIndexing.csproj @@ -13,6 +13,9 @@ + + compile + diff --git a/src/KurrentDB.Security.EncryptionAtRest.Tests/KurrentDB.Security.EncryptionAtRest.Tests.csproj b/src/KurrentDB.Security.EncryptionAtRest.Tests/KurrentDB.Security.EncryptionAtRest.Tests.csproj index 7f0f18d2b08..2e4e82ff0c9 100644 --- a/src/KurrentDB.Security.EncryptionAtRest.Tests/KurrentDB.Security.EncryptionAtRest.Tests.csproj +++ b/src/KurrentDB.Security.EncryptionAtRest.Tests/KurrentDB.Security.EncryptionAtRest.Tests.csproj @@ -1,6 +1,5 @@ - net8.0 enable enable diff --git a/src/KurrentDB.Security.EncryptionAtRest/KurrentDB.Security.EncryptionAtRest.csproj b/src/KurrentDB.Security.EncryptionAtRest/KurrentDB.Security.EncryptionAtRest.csproj index 2471f93bf34..758c0cc9704 100644 --- a/src/KurrentDB.Security.EncryptionAtRest/KurrentDB.Security.EncryptionAtRest.csproj +++ b/src/KurrentDB.Security.EncryptionAtRest/KurrentDB.Security.EncryptionAtRest.csproj @@ -1,7 +1,6 @@ - net8.0 Library true false diff --git a/src/KurrentDB.Security.EncryptionAtRest/Transforms/AesGcm/AesGcmChunkTransform.cs b/src/KurrentDB.Security.EncryptionAtRest/Transforms/AesGcm/AesGcmChunkTransform.cs index d51fd1920d4..b0f6a97b945 100644 --- a/src/KurrentDB.Security.EncryptionAtRest/Transforms/AesGcm/AesGcmChunkTransform.cs +++ b/src/KurrentDB.Security.EncryptionAtRest/Transforms/AesGcm/AesGcmChunkTransform.cs @@ -11,7 +11,6 @@ public sealed class AesGcmChunkTransform : IChunkTransform { public IChunkWriteTransform Write { get; } public AesGcmChunkTransform(ReadOnlyMemory key, int transformHeaderSize) { - ArgumentNullException.ThrowIfNull(key); ArgumentOutOfRangeException.ThrowIfNegative(transformHeaderSize); Read = new AesGcmChunkReadTransform(key, transformHeaderSize); diff --git a/src/KurrentDB.SourceGenerators.Tests/KurrentDB.SourceGenerators.Tests.csproj b/src/KurrentDB.SourceGenerators.Tests/KurrentDB.SourceGenerators.Tests.csproj index adffa3e49ad..2fef0a4a68f 100644 --- a/src/KurrentDB.SourceGenerators.Tests/KurrentDB.SourceGenerators.Tests.csproj +++ b/src/KurrentDB.SourceGenerators.Tests/KurrentDB.SourceGenerators.Tests.csproj @@ -1,4 +1,4 @@ - + true true @@ -26,15 +26,11 @@ - + - - - - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/KurrentDB.SourceGenerators.Tests/Messaging/CSharpSourceGeneratorVerifier.cs b/src/KurrentDB.SourceGenerators.Tests/Messaging/CSharpSourceGeneratorVerifier.cs index 2181cf4ddb0..2862f9ddf42 100644 --- a/src/KurrentDB.SourceGenerators.Tests/Messaging/CSharpSourceGeneratorVerifier.cs +++ b/src/KurrentDB.SourceGenerators.Tests/Messaging/CSharpSourceGeneratorVerifier.cs @@ -6,7 +6,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; +using Microsoft.CodeAnalysis.Testing; namespace KurrentDB.SourceGenerators.Tests.Messaging; @@ -14,7 +14,7 @@ namespace KurrentDB.SourceGenerators.Tests.Messaging; public static class CSharpSourceGeneratorVerifier where TSourceGenerator : ISourceGenerator, new() { - public class Test : CSharpSourceGeneratorTest { + public class Test : CSharpSourceGeneratorTest { public Test() { } diff --git a/src/KurrentDB.Surge.Testing/KurrentDB.Surge.Testing.csproj b/src/KurrentDB.Surge.Testing/KurrentDB.Surge.Testing.csproj index 9d8126fedc1..50bf939646c 100644 --- a/src/KurrentDB.Surge.Testing/KurrentDB.Surge.Testing.csproj +++ b/src/KurrentDB.Surge.Testing/KurrentDB.Surge.Testing.csproj @@ -3,11 +3,10 @@ - net8.0 + net10.0 Library enable true - preview xUnit1041 false @@ -25,7 +24,6 @@ - diff --git a/src/KurrentDB.Surge.Tests/KurrentDB.Surge.Tests.csproj b/src/KurrentDB.Surge.Tests/KurrentDB.Surge.Tests.csproj index 4445b81e73e..4e4fd1b0aa1 100644 --- a/src/KurrentDB.Surge.Tests/KurrentDB.Surge.Tests.csproj +++ b/src/KurrentDB.Surge.Tests/KurrentDB.Surge.Tests.csproj @@ -1,6 +1,5 @@  - net8.0 enable enable xUnit1041 @@ -13,6 +12,9 @@ + + compile + all diff --git a/src/KurrentDB.Surge/KurrentDB.Surge.csproj b/src/KurrentDB.Surge/KurrentDB.Surge.csproj index e2795d32eb2..2dca84b27fd 100644 --- a/src/KurrentDB.Surge/KurrentDB.Surge.csproj +++ b/src/KurrentDB.Surge/KurrentDB.Surge.csproj @@ -3,8 +3,7 @@ - net8.0 - preview + net10.0 enable enable true @@ -15,6 +14,9 @@ + + compile + diff --git a/src/KurrentDB.Surge/Producers/Converters.cs b/src/KurrentDB.Surge/Producers/Converters.cs index 7f507f6140a..2780a393dc8 100644 --- a/src/KurrentDB.Surge/Producers/Converters.cs +++ b/src/KurrentDB.Surge/Producers/Converters.cs @@ -15,10 +15,10 @@ public static class ProduceRequestExtensions { public static ValueTask ToEvents(this ProduceRequest request, Action configureHeaders, Serialize serialize) { return request.Messages .ToAsyncEnumerable() - .SelectAwait(async msg => await Map(msg.With(x => configureHeaders(x.Headers)), serialize)) + .Select((Message msg, CancellationToken _) => Map(msg.With(x => configureHeaders(x.Headers)), serialize)) .ToArrayAsync(); - static async Task Map(Message message, Serialize serialize) { + static async ValueTask Map(Message message, Serialize serialize) { var data = await serialize(message.Value, message.Headers); var eventId = Uuid.FromGuid(message.RecordId).ToGuid(); // not sure if needed... diff --git a/src/KurrentDB.Surge/Readers/SystemReader.cs b/src/KurrentDB.Surge/Readers/SystemReader.cs index e7deebff750..60f823daa75 100644 --- a/src/KurrentDB.Surge/Readers/SystemReader.cs +++ b/src/KurrentDB.Surge/Readers/SystemReader.cs @@ -102,7 +102,7 @@ public IAsyncEnumerable Read(StreamId streamId, StreamRevision revi var forwards = direction == ReadDirection.Forwards; return Client.Reading .ReadStream(streamId, CoreStreamRevision.FromInt64(revision.Value), maxCount, forwards, cancellationToken) - .SelectAwait(async record => await record.ToRecord(Deserialize, (int)record.Event.EventNumber + 1)); + .Select((ResolvedEvent record, CancellationToken _) => record.ToRecord(Deserialize, (int)record.Event.EventNumber + 1)); } public async ValueTask ReadLastStreamRecord(StreamId stream, CancellationToken cancellationToken = default) { diff --git a/src/KurrentDB.SystemRuntime.Tests/KurrentDB.SystemRuntime.Tests.csproj b/src/KurrentDB.SystemRuntime.Tests/KurrentDB.SystemRuntime.Tests.csproj index 18cde12bf9d..53428859190 100644 --- a/src/KurrentDB.SystemRuntime.Tests/KurrentDB.SystemRuntime.Tests.csproj +++ b/src/KurrentDB.SystemRuntime.Tests/KurrentDB.SystemRuntime.Tests.csproj @@ -5,10 +5,6 @@ - - - - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/KurrentDB.Testing.ClusterVNodeApp/KurrentDB.Testing.ClusterVNodeApp.csproj b/src/KurrentDB.Testing.ClusterVNodeApp/KurrentDB.Testing.ClusterVNodeApp.csproj index c848f4aef18..08b84c6f71a 100644 --- a/src/KurrentDB.Testing.ClusterVNodeApp/KurrentDB.Testing.ClusterVNodeApp.csproj +++ b/src/KurrentDB.Testing.ClusterVNodeApp/KurrentDB.Testing.ClusterVNodeApp.csproj @@ -1,7 +1,5 @@  - net8.0 - preview enable enable true diff --git a/src/KurrentDB.Testing/KurrentDB.Testing.csproj b/src/KurrentDB.Testing/KurrentDB.Testing.csproj index 4d8596b70a2..ee719c533cd 100644 --- a/src/KurrentDB.Testing/KurrentDB.Testing.csproj +++ b/src/KurrentDB.Testing/KurrentDB.Testing.csproj @@ -1,7 +1,5 @@ - net8.0 - preview enable enable true diff --git a/src/KurrentDB.Transport.Http/Client/HttpAsyncClient.cs b/src/KurrentDB.Transport.Http/Client/HttpAsyncClient.cs deleted file mode 100644 index 75a87f2dfe7..00000000000 --- a/src/KurrentDB.Transport.Http/Client/HttpAsyncClient.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Kurrent, Inc and/or licensed to Kurrent, Inc under one or more agreements. -// Kurrent, Inc licenses this file to you under the Kurrent License v1 (see LICENSE.md). - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading.Tasks; -using KurrentDB.Common.Utils; - -namespace KurrentDB.Transport.Http.Client; - -public class HttpAsyncClient : IHttpClient { - private readonly HttpClient _client; - - static HttpAsyncClient() { - ServicePointManager.MaxServicePointIdleTime = 10000; - ServicePointManager.DefaultConnectionLimit = 500; - } - - public HttpAsyncClient(TimeSpan timeout, HttpMessageHandler httpMessageHandler = null) { - _client = httpMessageHandler == null ? new HttpClient() : new HttpClient(httpMessageHandler); - _client.Timeout = timeout; - } - - public void Get(string url, Action onSuccess, Action onException) { - Get(url, null, onSuccess, onException); - } - - public void Get(string url, IEnumerable> headers, Action onSuccess, - Action onException) { - Ensure.NotNull(url, "url"); - Ensure.NotNull(onSuccess, "onSuccess"); - Ensure.NotNull(onException, "onException"); - - Receive(HttpMethod.Get, url, headers, onSuccess, onException); - } - - public void Post(string url, string body, string contentType, Action onSuccess, - Action onException) { - Post(url, body, contentType, null, onSuccess, onException); - } - - public void Post(string url, string body, string contentType, IEnumerable> headers, - Action onSuccess, Action onException) { - Ensure.NotNull(url, "url"); - Ensure.NotNull(body, "body"); - Ensure.NotNull(contentType, "contentType"); - Ensure.NotNull(onSuccess, "onSuccess"); - Ensure.NotNull(onException, "onException"); - - Send(HttpMethod.Post, url, body, contentType, headers, onSuccess, onException); - } - - public void Delete(string url, Action onSuccess, Action onException) { - Ensure.NotNull(url, "url"); - Ensure.NotNull(onSuccess, "onSuccess"); - Ensure.NotNull(onException, "onException"); - - Receive(HttpMethod.Delete, url, null, onSuccess, onException); - } - - public void Put(string url, string body, string contentType, Action onSuccess, - Action onException) { - Ensure.NotNull(url, "url"); - Ensure.NotNull(body, "body"); - Ensure.NotNull(contentType, "contentType"); - Ensure.NotNull(onSuccess, "onSuccess"); - Ensure.NotNull(onException, "onException"); - - Send(HttpMethod.Put, url, body, contentType, null, onSuccess, onException); - } - - public void Dispose() { - _client.Dispose(); - } - - private void Receive(string method, string url, IEnumerable> headers, - Action onSuccess, Action onException) { - var request = new HttpRequestMessage(); - request.Method = new System.Net.Http.HttpMethod(method); - request.RequestUri = new Uri(url); - - if (headers != null) { - foreach (var header in headers) { - request.Headers.Add(header.Key, header.Value); - } - } - - Task.Run(() => SendRequest(request, onSuccess, onException)); - } - - private void Send(string method, string url, string body, string contentType, - IEnumerable> headers, - Action onSuccess, Action onException) { - var bodyBytes = Helper.UTF8NoBom.GetBytes(body); - var stream = new MemoryStream(bodyBytes); - var request = new HttpRequestMessage { - Method = new System.Net.Http.HttpMethod(method), - RequestUri = new Uri(url), - Content = new StreamContent(stream) { - Headers = { - ContentType = new MediaTypeHeaderValue(contentType), - ContentLength = bodyBytes.Length - } - } - }; - - if (headers != null) { - foreach (var (key, value) in headers) { - request.Headers.Add(key, value); - } - } - - Task.Run(() => SendRequest(request, onSuccess, onException)); - } - - private async Task SendRequest(HttpRequestMessage request, Action onSuccess, Action onException) { - try { - using var response = await _client.SendAsync(request); - onSuccess(new HttpResponse(response) { - Body = await response.Content.ReadAsStringAsync() - }); - } catch (Exception ex) { - onException(ex); - throw; - } finally { - request.Dispose(); - } - } -} diff --git a/src/KurrentDB.Transport.Http/Client/IHttpClient.cs b/src/KurrentDB.Transport.Http/Client/IHttpClient.cs deleted file mode 100644 index 6ca25e871d0..00000000000 --- a/src/KurrentDB.Transport.Http/Client/IHttpClient.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Kurrent, Inc and/or licensed to Kurrent, Inc under one or more agreements. -// Kurrent, Inc licenses this file to you under the Kurrent License v1 (see LICENSE.md). - -using System; - -namespace KurrentDB.Transport.Http.Client; - -public interface IHttpClient { - void Get(string url, Action onSuccess, Action onException); - - void Post(string url, string request, string contentType, Action onSuccess, - Action onException); - - void Delete(string url, Action onSuccess, Action onException); - - void Put(string url, string request, string contentType, Action onSuccess, - Action onException); -} diff --git a/src/KurrentDB.Transport.Http/KurrentDB.Transport.Http.csproj b/src/KurrentDB.Transport.Http/KurrentDB.Transport.Http.csproj index 76867483c19..894832d5cf5 100644 --- a/src/KurrentDB.Transport.Http/KurrentDB.Transport.Http.csproj +++ b/src/KurrentDB.Transport.Http/KurrentDB.Transport.Http.csproj @@ -4,7 +4,6 @@ - diff --git a/src/KurrentDB.Transport.Tcp/TcpConnectionSsl.cs b/src/KurrentDB.Transport.Tcp/TcpConnectionSsl.cs index ea83b840863..d94181b5afa 100644 --- a/src/KurrentDB.Transport.Tcp/TcpConnectionSsl.cs +++ b/src/KurrentDB.Transport.Tcp/TcpConnectionSsl.cs @@ -291,23 +291,7 @@ public bool ValidateClientCertificate(object sender, X509Certificate certificate private void DisplaySslStreamInfo(SslStream stream) { Log.Information("[S{remoteEndPoint}, L{localEndPoint}]", RemoteEndPoint, LocalEndPoint); - Log.Verbose("Cipher: {cipherAlgorithm}", stream.CipherAlgorithm); - try { - Log.Verbose("Cipher strength: {cipherStrength}", stream.CipherStrength); - } catch (NotImplementedException) { - } - - Log.Verbose("Hash: {hashAlgorithm}", stream.HashAlgorithm); - try { - Log.Verbose("Hash strength: {hashStrength}", stream.HashStrength); - } catch (NotImplementedException) { - } - - Log.Verbose("Key exchange: {keyExchangeAlgorithm}", stream.KeyExchangeAlgorithm); - try { - Log.Verbose("Key exchange strength: {keyExchangeStrength}", stream.KeyExchangeStrength); - } catch (NotImplementedException) { - } + Log.Verbose("NegotiatedCipherSuite: {cipherSuite}", stream.NegotiatedCipherSuite); Log.Information("Protocol: {sslProtocol}", stream.SslProtocol); Log.Information("Is authenticated: {isAuthenticated} as server? {isServer}", stream.IsAuthenticated, diff --git a/src/KurrentDB.UI/KurrentDB.UI.csproj b/src/KurrentDB.UI/KurrentDB.UI.csproj index fe35dbd4ed6..3b8946f4611 100644 --- a/src/KurrentDB.UI/KurrentDB.UI.csproj +++ b/src/KurrentDB.UI/KurrentDB.UI.csproj @@ -1,6 +1,5 @@ - net8.0 enable enable true diff --git a/src/KurrentDB/Components/Auth/Login.razor b/src/KurrentDB/Components/Auth/Login.razor index 0ffd87636d6..8d9eae4f397 100644 --- a/src/KurrentDB/Components/Auth/Login.razor +++ b/src/KurrentDB/Components/Auth/Login.razor @@ -48,10 +48,14 @@ [Inject] NavigationManager NavigationManager { get; set; } [Inject] IAuthenticationProvider AuthProvider { get; set; } [Inject] ISnackbar Snackbar { get; set; } - [SupplyParameterFromForm] LoginInputModel Input { get; set; } = new(); + [SupplyParameterFromForm] LoginInputModel Input { get; set; } [SupplyParameterFromQuery] string ReturnUrl { get; set; } [CascadingParameter] HttpContext HttpContext { get; set; } = default!; + protected override void OnInitialized() { + Input ??= new(); + } + protected override async Task OnAfterRenderAsync(bool firstRender) { var authenticated = HttpContext.User.Identity?.IsAuthenticated == true; Console.WriteLine(authenticated); diff --git a/src/KurrentDB/Polyfills/ExcludeFromInteractiveRoutingAttribute.cs b/src/KurrentDB/Polyfills/ExcludeFromInteractiveRoutingAttribute.cs deleted file mode 100644 index 5ca262b228b..00000000000 --- a/src/KurrentDB/Polyfills/ExcludeFromInteractiveRoutingAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Kurrent, Inc and/or licensed to Kurrent, Inc under one or more agreements. -// Kurrent, Inc licenses this file to you under the Kurrent License v1 (see LICENSE.md). - -using System; - -// ReSharper disable once CheckNamespace -namespace Microsoft.AspNetCore.Components; - -/// -/// When applied to a page component, indicates that the interactive component should -/// ignore that page. This means that navigations to the page will not be resolved by interactive routing, -/// but instead will cause a full page reload. -/// -[AttributeUsage(AttributeTargets.Class)] -public sealed class ExcludeFromInteractiveRoutingAttribute : Attribute; diff --git a/src/KurrentDB/Polyfills/RazorComponentsEndpointHttpContextExtensions.cs b/src/KurrentDB/Polyfills/RazorComponentsEndpointHttpContextExtensions.cs deleted file mode 100644 index 7b8e2639f0d..00000000000 --- a/src/KurrentDB/Polyfills/RazorComponentsEndpointHttpContextExtensions.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Kurrent, Inc and/or licensed to Kurrent, Inc under one or more agreements. -// Kurrent, Inc licenses this file to you under the Kurrent License v1 (see LICENSE.md). - -using System; -using System.Collections.Concurrent; -using System.Reflection; -using System.Reflection.Metadata; -using Microsoft.AspNetCore.Components.Endpoints; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Http; - -[assembly: MetadataUpdateHandler(typeof(RazorComponentsEndpointHttpContextExtensions.MetadataUpdateHandler))] - -// ReSharper disable once CheckNamespace -namespace Microsoft.AspNetCore.Components.Routing; - -public static class RazorComponentsEndpointHttpContextExtensions { - static readonly ConcurrentDictionary AcceptsInteractiveRoutingCache = new(); - - /// - /// Determines whether the current endpoint is a Razor component that can be reached through - /// interactive routing. This is true for all page components except if they declare the - /// attribute . - /// - /// The . - /// True if the current endpoint is a Razor component that does not declare . - public static bool AcceptsInteractiveRouting(this HttpContext context) { - ArgumentNullException.ThrowIfNull(context); - - var pageType = context.GetEndpoint()?.Metadata.GetMetadata()?.Type; - - return pageType is not null - && AcceptsInteractiveRoutingCache.GetOrAdd( - pageType, - static pageType => !pageType.IsDefined(typeof(ExcludeFromInteractiveRoutingAttribute))); - } - - internal static class MetadataUpdateHandler { - /// - /// Invoked as part of contract for hot reload. - /// - public static void ClearCache(Type[] _) => AcceptsInteractiveRoutingCache.Clear(); - } -} diff --git a/src/SchemaRegistry/KurrentDB.Plugins.SchemaRegistry/KurrentDB.Plugins.SchemaRegistry.csproj b/src/SchemaRegistry/KurrentDB.Plugins.SchemaRegistry/KurrentDB.Plugins.SchemaRegistry.csproj index 6ae1e999beb..9fd9bf61a50 100644 --- a/src/SchemaRegistry/KurrentDB.Plugins.SchemaRegistry/KurrentDB.Plugins.SchemaRegistry.csproj +++ b/src/SchemaRegistry/KurrentDB.Plugins.SchemaRegistry/KurrentDB.Plugins.SchemaRegistry.csproj @@ -5,7 +5,6 @@ true enable true - preview false true true diff --git a/src/SchemaRegistry/KurrentDB.SchemaRegistry.Protocol/KurrentDB.SchemaRegistry.Protocol.csproj b/src/SchemaRegistry/KurrentDB.SchemaRegistry.Protocol/KurrentDB.SchemaRegistry.Protocol.csproj index efbf1fd8e9f..f4dc5151054 100644 --- a/src/SchemaRegistry/KurrentDB.SchemaRegistry.Protocol/KurrentDB.SchemaRegistry.Protocol.csproj +++ b/src/SchemaRegistry/KurrentDB.SchemaRegistry.Protocol/KurrentDB.SchemaRegistry.Protocol.csproj @@ -3,7 +3,7 @@ - net8.0 + net10.0 true true diff --git a/src/SchemaRegistry/KurrentDB.SchemaRegistry.Tests/KurrentDB.SchemaRegistry.Tests.csproj b/src/SchemaRegistry/KurrentDB.SchemaRegistry.Tests/KurrentDB.SchemaRegistry.Tests.csproj index e7648a04716..0a39231a18c 100644 --- a/src/SchemaRegistry/KurrentDB.SchemaRegistry.Tests/KurrentDB.SchemaRegistry.Tests.csproj +++ b/src/SchemaRegistry/KurrentDB.SchemaRegistry.Tests/KurrentDB.SchemaRegistry.Tests.csproj @@ -3,7 +3,7 @@ - net8.0 + net10.0 enable enable true diff --git a/src/SchemaRegistry/KurrentDB.SchemaRegistry/KurrentDB.SchemaRegistry.csproj b/src/SchemaRegistry/KurrentDB.SchemaRegistry/KurrentDB.SchemaRegistry.csproj index df0748388db..881a37b2eae 100644 --- a/src/SchemaRegistry/KurrentDB.SchemaRegistry/KurrentDB.SchemaRegistry.csproj +++ b/src/SchemaRegistry/KurrentDB.SchemaRegistry/KurrentDB.SchemaRegistry.csproj @@ -3,8 +3,7 @@ - net8.0 - preview + net10.0 enable enable true