From cd410d87c7314d47bede811552fccaa1fb29a5a6 Mon Sep 17 00:00:00 2001 From: pngdeity Date: Thu, 26 Feb 2026 03:23:47 -0600 Subject: [PATCH 1/2] Upgrade core frameworks and codebase to .NET 10.0 --- .../ClassTranscribeDatabase.csproj | 26 +++++++------ ClassTranscribeDatabase/global.json | 2 +- .../ClassTranscribeServer.csproj | 39 +++++++++---------- ClassTranscribeServer/Program.cs | 33 +++++++++------- ClassTranscribeServer/global.json | 2 +- DevExperiments/DevExperiments.csproj | 10 ++--- Directory.Build.props | 5 +++ TaskEngine/TaskEngine.csproj | 12 +++--- TaskEngine/global.json | 2 +- .../TestAzureCognitiveServices.csproj | 4 +- TestRemoteLLM/TestRemoteLLM.csproj | 4 +- UnitTests/UnitTests.csproj | 17 ++++---- 12 files changed, 84 insertions(+), 72 deletions(-) create mode 100644 Directory.Build.props diff --git a/ClassTranscribeDatabase/ClassTranscribeDatabase.csproj b/ClassTranscribeDatabase/ClassTranscribeDatabase.csproj index e43371f8..8f05a717 100644 --- a/ClassTranscribeDatabase/ClassTranscribeDatabase.csproj +++ b/ClassTranscribeDatabase/ClassTranscribeDatabase.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 @@ -29,29 +29,31 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - + + + - + + + diff --git a/ClassTranscribeDatabase/global.json b/ClassTranscribeDatabase/global.json index 215288b9..6e3fab8c 100644 --- a/ClassTranscribeDatabase/global.json +++ b/ClassTranscribeDatabase/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0" + "version": "10.0" } } \ No newline at end of file diff --git a/ClassTranscribeServer/ClassTranscribeServer.csproj b/ClassTranscribeServer/ClassTranscribeServer.csproj index 65c581f9..9c73fc3d 100644 --- a/ClassTranscribeServer/ClassTranscribeServer.csproj +++ b/ClassTranscribeServer/ClassTranscribeServer.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 InProcess 232163e5-4e61-44e2-a21b-f2c37da7a892 Linux @@ -42,34 +42,33 @@ - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + - - + + - - - - - - + + + + + + diff --git a/ClassTranscribeServer/Program.cs b/ClassTranscribeServer/Program.cs index e6535197..47b1a244 100644 --- a/ClassTranscribeServer/Program.cs +++ b/ClassTranscribeServer/Program.cs @@ -1,7 +1,7 @@ using ClassTranscribeDatabase; -using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using System; @@ -11,25 +11,30 @@ public static class Program { public static void Main(string[] args) { - CreateWebHostBuilder(args).Build().Run(); + CreateHostBuilder(args).Build().Run(); } - public static IWebHostBuilder CreateWebHostBuilder(string[] args) + public static IHostBuilder CreateHostBuilder(string[] args) { - var v = WebHost.CreateDefaultBuilder(args) - .ConfigureServices(c => c.AddOptions().Configure(CTDbContext.GetConfigurations())); - - // TTODO better code would use AppSettings + return Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .ConfigureServices((hostContext, services) => + { + services.AddOptions().Configure(CTDbContext.GetConfigurations()); - string viewSQL = Environment.GetEnvironmentVariable("LogEntityFrameworkSQL") ?? "false"; + string viewSQL = Environment.GetEnvironmentVariable("LogEntityFrameworkSQL") ?? "false"; - if( viewSQL.Trim().ToUpperInvariant() != "TRUE") { - - v.ConfigureLogging((context, logging) => { - logging.AddFilter("Microsoft.EntityFrameworkCore.Database.Command", LogLevel.Warning); + if (viewSQL.Trim().ToUpperInvariant() != "TRUE") + { + services.AddLogging(logging => + { + logging.AddFilter("Microsoft.EntityFrameworkCore.Database.Command", LogLevel.Warning); + }); + } }); - } - return v.UseStartup(); } } } diff --git a/ClassTranscribeServer/global.json b/ClassTranscribeServer/global.json index 215288b9..6e3fab8c 100644 --- a/ClassTranscribeServer/global.json +++ b/ClassTranscribeServer/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0" + "version": "10.0" } } \ No newline at end of file diff --git a/DevExperiments/DevExperiments.csproj b/DevExperiments/DevExperiments.csproj index 9fbad1a5..be1ee9b7 100644 --- a/DevExperiments/DevExperiments.csproj +++ b/DevExperiments/DevExperiments.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 @@ -11,11 +11,11 @@ - + - - - + + + diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..9949ef02 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + true + + diff --git a/TaskEngine/TaskEngine.csproj b/TaskEngine/TaskEngine.csproj index 31504a84..62a55375 100644 --- a/TaskEngine/TaskEngine.csproj +++ b/TaskEngine/TaskEngine.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 @@ -16,17 +16,17 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + - + diff --git a/TaskEngine/global.json b/TaskEngine/global.json index 215288b9..6e3fab8c 100644 --- a/TaskEngine/global.json +++ b/TaskEngine/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0" + "version": "10.0" } } \ No newline at end of file diff --git a/TestAzureCognitiveServices/TestAzureCognitiveServices.csproj b/TestAzureCognitiveServices/TestAzureCognitiveServices.csproj index 35e56bac..8d1774d3 100644 --- a/TestAzureCognitiveServices/TestAzureCognitiveServices.csproj +++ b/TestAzureCognitiveServices/TestAzureCognitiveServices.csproj @@ -2,11 +2,11 @@ Exe - net8.0 + net10.0 - + diff --git a/TestRemoteLLM/TestRemoteLLM.csproj b/TestRemoteLLM/TestRemoteLLM.csproj index 2acfcc44..58669970 100644 --- a/TestRemoteLLM/TestRemoteLLM.csproj +++ b/TestRemoteLLM/TestRemoteLLM.csproj @@ -2,13 +2,13 @@ Exe - net8.0 + net10.0 enable enable - + diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index d5910c15..2efdf6cc 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -1,24 +1,25 @@ - net8.0 + net10.0 false - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + + From 3e5364a4109cb3f227f7f155d00f5ce04e85bedf Mon Sep 17 00:00:00 2001 From: pngdeity Date: Thu, 26 Feb 2026 03:23:47 -0600 Subject: [PATCH 2/2] Modernize container infrastructure and fix Speech SDK dependencies --- .github/workflows/ci.yaml | 2 +- API.Dockerfile | 17 ++++---- TaskEngine.Dockerfile | 12 +++--- .../TestAzure.Dockerfile | 36 +++++++++-------- TestAzureCognitiveServices/install-libssl1.sh | 10 ++--- UnitTests/SpeechSDKLoadTest.cs | 40 +++++++++++++++++++ 6 files changed, 81 insertions(+), 36 deletions(-) create mode 100644 UnitTests/SpeechSDKLoadTest.cs diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1771a154..e165f2e5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-dotnet@v1 with: - dotnet-version: '8.0.x' # SDK Version to use; x will use the latest version of the channel + dotnet-version: '10.0.x' # SDK Version to use; x will use the latest version of the channel - uses: actions/cache@v4 with: diff --git a/API.Dockerfile b/API.Dockerfile index 93857aa6..ae9f8380 100644 --- a/API.Dockerfile +++ b/API.Dockerfile @@ -12,9 +12,7 @@ # -#FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim-amd64 as build -FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build -#notyet FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build # See https://mcr.microsoft.com/en-us/product/dotnet/sdk/tags # Running the AMD64 version is of the SDK is broken @@ -26,6 +24,7 @@ WORKDIR / RUN git clone https://github.com/eficode/wait-for.git WORKDIR /src +COPY ./Directory.Build.props ./ COPY ./ClassTranscribeDatabase/ClassTranscribeDatabase.csproj ./ClassTranscribeDatabase/ClassTranscribeDatabase.csproj # Did not help ENV DOTNET_NUGET_SIGNATURE_VERIFICATION=false # Add --verbosity normal|diagnostic @@ -42,12 +41,14 @@ COPY ./ClassTranscribeDatabase ./ClassTranscribeDatabase WORKDIR /src/ClassTranscribeServer RUN dotnet publish ClassTranscribeServer.csproj -c Release -o /app --no-restore -#Not yet FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble AS publish_base -FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim as publish_base -# FROM mcr.microsoft.com/dotnet/aspnet:7.0.14-bookworm-slim as publish_base +FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble AS publish_base -# FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.3-bionic as publish_base -RUN apt-get -q update && apt-get -qy install netcat-traditional +# Install libasound2t64 and create a symlink to map it to the legacy filename expected by the Speech SDK. +# This ensures native binaries searching for libasound.so.2 can resolve the dependency on Ubuntu 24.04. +RUN apt-get -q update && \ + apt-get install -y libasound2t64 netcat-traditional && \ + ln -s /usr/lib/x86_64-linux-gnu/libasound.so.2 /usr/lib/libasound.so.2 && \ + apt-get -q update FROM publish_base AS publish WORKDIR / diff --git a/TaskEngine.Dockerfile b/TaskEngine.Dockerfile index 4a0ac085..fb277b4b 100644 --- a/TaskEngine.Dockerfile +++ b/TaskEngine.Dockerfile @@ -1,5 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim as build -#not yet FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build # See https://mcr.microsoft.com/en-us/product/dotnet/sdk/tags #See more comments in API.Dockerfile # RUN ls @@ -9,6 +8,7 @@ WORKDIR / RUN git clone https://github.com/eficode/wait-for.git WORKDIR /src +COPY ./Directory.Build.props ./ COPY ./ClassTranscribeDatabase/ClassTranscribeDatabase.csproj ./ClassTranscribeDatabase/ClassTranscribeDatabase.csproj # --verbosity normal|diagnostic @@ -25,8 +25,7 @@ COPY ./TaskEngine ./TaskEngine WORKDIR /src/TaskEngine RUN dotnet publish TaskEngine.csproj -c Release -o /app --no-restore -FROM mcr.microsoft.com/dotnet/aspnet:8.0 as publish_base -#notyet FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS publish_base +FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble AS publish_base # https://hub.docker.com/_/microsoft-dotnet-aspnet/ # force AMD64 build here: the ssl1.1.1 workaround below assumes amd64 @@ -34,7 +33,10 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 as publish_base # See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform # 10.0 libasound2 replaced with libasound2t64 -RUN apt-get update && apt-get install -y build-essential libssl-dev ca-certificates libasound2 wget && \ +# Create a symlink to map the new t64 library to the legacy filename expected by the Speech SDK. +# This ensures native binaries searching for libasound.so.2 can resolve the dependency on Ubuntu 24.04. +RUN apt-get update && apt-get install -y build-essential libssl-dev ca-certificates libasound2t64 wget && \ +ln -s /usr/lib/x86_64-linux-gnu/libasound.so.2 /usr/lib/libasound.so.2 && \ apt-get install -y netcat-traditional && apt-get -q update # Microsoft 8.0 issue: https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/2204 diff --git a/TestAzureCognitiveServices/TestAzure.Dockerfile b/TestAzureCognitiveServices/TestAzure.Dockerfile index 591a27f3..bcda8487 100644 --- a/TestAzureCognitiveServices/TestAzure.Dockerfile +++ b/TestAzureCognitiveServices/TestAzure.Dockerfile @@ -1,34 +1,36 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0.100-1-bookworm-slim as build1 +FROM mcr.microsoft.com/dotnet/sdk:10.0-noble as build1 +WORKDIR /src +COPY ./Directory.Build.props ./ +COPY ./ClassTranscribeDatabase/ClassTranscribeDatabase.csproj ./ClassTranscribeDatabase/ WORKDIR /src/TestAzureCognitiveServices - -COPY . . +COPY ./TestAzureCognitiveServices/TestAzureCognitiveServices.csproj ./ RUN dotnet restore ./TestAzureCognitiveServices.csproj -RUN dotnet publish ./TestAzureCognitiveServices.csproj -c Release -o /app --no-restore - -#FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim as publish_base1 -# FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim-arm64v8 as publish_base1 -FROM mcr.microsoft.com/dotnet/aspnet:8.0 as publish_base1 -#COPY ./Program.cs / +WORKDIR /src +COPY ./ClassTranscribeDatabase ./ClassTranscribeDatabase +COPY ./TestAzureCognitiveServices ./TestAzureCognitiveServices +WORKDIR /src/TestAzureCognitiveServices +RUN dotnet publish ./TestAzureCognitiveServices.csproj -c Release -o /app --no-restore -# Grrr AzureServices does not work on dotnet8 on Debian 12 because it wont link to libssl3 - fix below is needed for short-term +FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble as publish_base1 -# Install prerequisites for Azure Speech Services -# See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform -RUN apt-get update -RUN apt-get -y install build-essential libssl-dev libasound2 wget +# Install libasound2t64 and create a symlink to map it to the legacy filename expected by the Speech SDK. +# This ensures native binaries searching for libasound.so.2 can resolve the dependency on Ubuntu 24.04. +RUN apt-get update && \ + apt-get install -y libasound2t64 build-essential libssl-dev wget && \ + ln -s /usr/lib/x86_64-linux-gnu/libasound.so.2 /usr/lib/libasound.so.2 && \ + apt-get -q update # Microsoft 8.0 issue: https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/2204 # This will install OpenSSL 1.1.1 because it is needed by the Speech SDK. -#RUN ARCH=$(dpkg --print-architecture) -COPY ./install-libssl1.sh / +COPY ./TestAzureCognitiveServices/install-libssl1.sh / RUN /install-libssl1.sh FROM publish_base1 as publish1 WORKDIR /app COPY --from=build1 /app . -COPY shortwav.wav / +COPY ./TestAzureCognitiveServices/shortwav.wav / CMD ["dotnet", "/app/TestAzureCognitiveServices.dll"] # Example diff --git a/TestAzureCognitiveServices/install-libssl1.sh b/TestAzureCognitiveServices/install-libssl1.sh index 57641c65..b3bba383 100755 --- a/TestAzureCognitiveServices/install-libssl1.sh +++ b/TestAzureCognitiveServices/install-libssl1.sh @@ -8,10 +8,10 @@ else BASE="http://security.ubuntu.com/ubuntu/pool/main/o/openssl/" fi -wget $BASE/libssl1.1_1.1.1f-1ubuntu2.20_${ARCH}.deb -wget $BASE/libssl-dev_1.1.1f-1ubuntu2.20_${ARCH}.deb -dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_${ARCH}.deb -dpkg -i libssl-dev_1.1.1f-1ubuntu2.20_${ARCH}.deb -rm libssl1.1_1.1.1f-1ubuntu2.20_${ARCH}.deb libssl-dev_1.1.1f-1ubuntu2.20_${ARCH}.deb +wget $BASE/libssl1.1_1.1.1f-1ubuntu2.24_${ARCH}.deb +wget $BASE/libssl-dev_1.1.1f-1ubuntu2.24_${ARCH}.deb +dpkg -i libssl1.1_1.1.1f-1ubuntu2.24_${ARCH}.deb +dpkg -i libssl-dev_1.1.1f-1ubuntu2.24_${ARCH}.deb +rm libssl1.1_1.1.1f-1ubuntu2.24_${ARCH}.deb libssl-dev_1.1.1f-1ubuntu2.24_${ARCH}.deb diff --git a/UnitTests/SpeechSDKLoadTest.cs b/UnitTests/SpeechSDKLoadTest.cs new file mode 100644 index 00000000..0b578277 --- /dev/null +++ b/UnitTests/SpeechSDKLoadTest.cs @@ -0,0 +1,40 @@ +using System; +using Microsoft.CognitiveServices.Speech; +using Xunit; + +namespace UnitTests +{ + public class SpeechSDKLoadTest + { + [Fact] + public void TestNativeLibraryLoad() + { + try + { + var config = SpeechConfig.FromSubscription("d82a4773-4e61-44e2-a21b-f2c37da7a892", "westus"); + // Attempting to create a recognizer triggers full native library initialization including audio. + using (var recognizer = new SpeechRecognizer(config)) + { + Assert.NotNull(recognizer); + } + } + catch (TypeInitializationException ex) + { + Assert.Fail($"Failed to load native Speech SDK library: {ex.Message} {ex.InnerException?.Message}"); + } + catch (DllNotFoundException ex) + { + Assert.Fail($"Native Speech SDK library or dependency not found: {ex.Message}"); + } + catch (Exception ex) + { + // If it's just an auth error, the library LOADED successfully. + if (ex.Message.Contains("Subscription key") || ex.Message.Contains("region") || ex.Message.Contains("Exception with error code")) + { + return; + } + throw; + } + } + } +}