From 8d9b15bd5fe8573c2ea7cee33fdbb7b45a6c6c13 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 25 Oct 2026 19:10:21 +0100 Subject: [PATCH] Fixed CI building with a newer .NET SDK than the metadata names (#1107) --- .github/workflows/build-and-release.yml | 24 +++++++++++++++++++ .../ClassicRagOutboundDataRestrictionTests.cs | 7 ++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a3281141e..b7072e818 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -803,6 +803,18 @@ jobs: cache: true cache-dependency-path: 'app/MindWork AI Studio/packages.lock.json' + - name: Pin the .NET SDK from the metadata + shell: bash + run: | + # The runner images bring several .NET SDKs along, newer ones among them. Without a + # global.json, the newest of them builds instead of the one installed above from the + # metadata, and with it comes a newer C# version than the one we build with locally. + # The file exists in the pipeline only, so metadata.txt stays the one place which names + # the SDK. Bash runs on Windows as well, so that a failing command fails the step: + dotnet new globaljson --sdk-version "${DOTNET_SDK_VERSION}" --roll-forward disable --force + used_dotnet_sdk_version=$(dotnet --version) + echo ".NET SDK in use: '${used_dotnet_sdk_version}'" + - name: Cache Rust uses: actions/cache@v4 with: @@ -1055,6 +1067,18 @@ jobs: cache: true cache-dependency-path: 'app/MindWork AI Studio/packages.lock.json' + - name: Pin the .NET SDK from the metadata + shell: bash + run: | + # The runner images bring several .NET SDKs along, newer ones among them. Without a + # global.json, the newest of them builds instead of the one installed above from the + # metadata, and with it comes a newer C# version than the one we build with locally. + # The file exists in the pipeline only, so metadata.txt stays the one place which names + # the SDK. Bash runs on Windows as well, so that a failing command fails the step: + dotnet new globaljson --sdk-version "${DOTNET_SDK_VERSION}" --roll-forward disable --force + used_dotnet_sdk_version=$(dotnet --version) + echo ".NET SDK in use: '${used_dotnet_sdk_version}'" + - name: Deploy PDFium (Unix) if: matrix.platform != 'windows-latest' env: diff --git a/app/Tests/Tools/ClassicRagOutboundDataRestrictionTests.cs b/app/Tests/Tools/ClassicRagOutboundDataRestrictionTests.cs index 490fb7c7e..923b854aa 100644 --- a/app/Tests/Tools/ClassicRagOutboundDataRestrictionTests.cs +++ b/app/Tests/Tools/ClassicRagOutboundDataRestrictionTests.cs @@ -68,10 +68,13 @@ public sealed class ClassicRagOutboundDataRestrictionTests : ToolRegistryTestBas { // // Semantic Search offers the data sources in a fixed order, while the selection agent of the - // classic process may return them in any order. Both have to name the same data source: + // classic process may return them in any order. Both have to name the same data source. + // + // AsEnumerable() keeps Reverse() a reversed copy: from C# 14 on, Reverse() on an array + // reverses the array in place and returns nothing. // var classicChat = new ChatThread(); - AISrcSelWithRetCtxVal.RequireOutboundDataRestriction(classicChat, dataSources.Reverse().ToArray(), passageCounts.Reverse().ToArray(), organizationMinimum); + AISrcSelWithRetCtxVal.RequireOutboundDataRestriction(classicChat, [..dataSources.AsEnumerable().Reverse()], [..passageCounts.AsEnumerable().Reverse()], organizationMinimum); var semanticSearchChat = new ChatThread(); semanticSearchChat.RequireOutboundDataRestriction(SemanticSearchTool.GetRequirements(dataSources, passageCounts, organizationMinimum).OutboundData);