From 071e0f25796be2adc7bfe1f4d4ce5a68a24fd8a0 Mon Sep 17 00:00:00 2001 From: qdraw Date: Tue, 8 Oct 2024 18:37:48 +0000 Subject: [PATCH 1/5] Auto .NET SDK version Upgrade to 8.0.403 --- .../desktop-release-on-tag-net-electron.yml | 2 +- .github/workflows/webapp-build-net-macos.yml | 2 +- .github/workflows/webapp-build-net-ubuntu.yml | 2 +- .../workflows/webapp-build-net-windows.yml | 2 +- .../webapp-codecov-clientapp-netcore.yml | 2 +- .../webapp-sonarqube-clientapp-netcore.yml | 2 +- .../webapp-update-swagger-dotnet.yml | 2 +- pipelines/azure/steps/use_dotnet_version.yml | 4 +- starsky/global.json | 2 +- starsky/nuget-packages-list.json | 46 +++++++++---------- .../starsky.feature.geolookup.csproj | 4 +- .../starsky.feature.health.csproj | 6 +-- .../starsky.feature.syncbackground.csproj | 2 +- ...tarsky.foundation.accountmanagement.csproj | 2 +- .../starsky.foundation.database.csproj | 16 +++---- .../starsky.foundation.injection.csproj | 4 +- .../starsky.foundation.platform.csproj | 8 ++-- .../starsky.foundation.readmeta.csproj | 2 +- .../starsky.foundation.realtime.csproj | 4 +- .../starsky.foundation.sync.csproj | 2 +- .../starsky.foundation.webtelemetry.csproj | 8 ++-- .../starsky.foundation.worker.csproj | 2 +- .../starsky.foundation.writemeta.csproj | 2 +- starsky/starsky/starsky.csproj | 6 +-- .../starskyadmincli/starskyadmincli.csproj | 2 +- .../starskydemoseedcli.csproj | 2 +- starsky/starskygeocli/starskygeocli.csproj | 2 +- .../starskyimportercli.csproj | 2 +- .../starskysynchronizecli.csproj | 2 +- starsky/starskytest/starskytest.csproj | 10 ++-- .../starskythumbnailcli.csproj | 2 +- .../starskythumbnailmetacli.csproj | 2 +- .../starskywebftpcli/starskywebftpcli.csproj | 2 +- .../starskywebhtmlcli.csproj | 2 +- 34 files changed, 81 insertions(+), 81 deletions(-) diff --git a/.github/workflows/desktop-release-on-tag-net-electron.yml b/.github/workflows/desktop-release-on-tag-net-electron.yml index 957afa9594..e7ed964ac7 100644 --- a/.github/workflows/desktop-release-on-tag-net-electron.yml +++ b/.github/workflows/desktop-release-on-tag-net-electron.yml @@ -22,7 +22,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.402 + dotnet-version: 8.0.403 - name: Build --no-unit-test linux-arm,linux-arm64,win-x64,osx-x64,linux-x64,osx-arm64 --ready-to-run shell: bash diff --git a/.github/workflows/webapp-build-net-macos.yml b/.github/workflows/webapp-build-net-macos.yml index 21d7ef22fc..ab4cee45c4 100644 --- a/.github/workflows/webapp-build-net-macos.yml +++ b/.github/workflows/webapp-build-net-macos.yml @@ -35,7 +35,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.402 + dotnet-version: 8.0.403 - name: "BuildNetCore (MacOS)" shell: bash diff --git a/.github/workflows/webapp-build-net-ubuntu.yml b/.github/workflows/webapp-build-net-ubuntu.yml index 65d7c79390..df1fd8749c 100644 --- a/.github/workflows/webapp-build-net-ubuntu.yml +++ b/.github/workflows/webapp-build-net-ubuntu.yml @@ -38,7 +38,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.402 + dotnet-version: 8.0.403 - name: Cache nuget packages (*nix) uses: actions/cache@v4 diff --git a/.github/workflows/webapp-build-net-windows.yml b/.github/workflows/webapp-build-net-windows.yml index 2ea84c3042..aba1441d4a 100644 --- a/.github/workflows/webapp-build-net-windows.yml +++ b/.github/workflows/webapp-build-net-windows.yml @@ -35,7 +35,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.402 + dotnet-version: 8.0.403 - name: Build (Windows) shell: pwsh diff --git a/.github/workflows/webapp-codecov-clientapp-netcore.yml b/.github/workflows/webapp-codecov-clientapp-netcore.yml index 6dd2ce1e59..d3ccb5189c 100644 --- a/.github/workflows/webapp-codecov-clientapp-netcore.yml +++ b/.github/workflows/webapp-codecov-clientapp-netcore.yml @@ -26,7 +26,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.402 + dotnet-version: 8.0.403 - name: Cache node modules clientapp (*nix) uses: actions/cache@v4 diff --git a/.github/workflows/webapp-sonarqube-clientapp-netcore.yml b/.github/workflows/webapp-sonarqube-clientapp-netcore.yml index 643cc3da98..374221fb2e 100644 --- a/.github/workflows/webapp-sonarqube-clientapp-netcore.yml +++ b/.github/workflows/webapp-sonarqube-clientapp-netcore.yml @@ -45,7 +45,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.402 + dotnet-version: 8.0.403 - name: Use Java 17 uses: actions/setup-java@v4 diff --git a/.github/workflows/webapp-update-swagger-dotnet.yml b/.github/workflows/webapp-update-swagger-dotnet.yml index 3d75364d87..ec2738f4ad 100644 --- a/.github/workflows/webapp-update-swagger-dotnet.yml +++ b/.github/workflows/webapp-update-swagger-dotnet.yml @@ -29,7 +29,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.402 + dotnet-version: 8.0.403 - name: Cache nuget packages (*nix) uses: actions/cache@v4 diff --git a/pipelines/azure/steps/use_dotnet_version.yml b/pipelines/azure/steps/use_dotnet_version.yml index 161a00d5a8..b4d494c39e 100644 --- a/pipelines/azure/steps/use_dotnet_version.yml +++ b/pipelines/azure/steps/use_dotnet_version.yml @@ -1,9 +1,9 @@ steps: - task: UseDotNet@2 - displayName: 'Use .NET SDK 8.0.402' + displayName: 'Use .NET SDK 8.0.403' enabled: true inputs: packageType: sdk - version: 8.0.402 + version: 8.0.403 installationPath: $(Agent.ToolsDirectory)/dotnet performMultiLevelLookup: true \ No newline at end of file diff --git a/starsky/global.json b/starsky/global.json index 95b072a76b..f70757a8bd 100644 --- a/starsky/global.json +++ b/starsky/global.json @@ -1,7 +1,7 @@ { "strictVersion": true, "sdk": { - "version": "8.0.402", + "version": "8.0.403", "rollForward": "disable", "allowPrerelease": false } diff --git a/starsky/nuget-packages-list.json b/starsky/nuget-packages-list.json index 7e25c08d82..fb590fc7c9 100644 --- a/starsky/nuget-packages-list.json +++ b/starsky/nuget-packages-list.json @@ -1,46 +1,46 @@ [ - "Microsoft.AspNetCore.Mvc.NewtonsoftJson 8.0.8", - "Microsoft.Extensions.Hosting.WindowsServices 8.0.0", + "Microsoft.AspNetCore.Mvc.NewtonsoftJson 8.0.10", + "Microsoft.Extensions.Hosting.WindowsServices 8.0.1", "Swashbuckle.AspNetCore 6.8.1", "Microsoft.Extensions.Caching.Abstractions 8.0.0", - "Microsoft.Extensions.Caching.Memory 8.0.0", - "Microsoft.Extensions.Hosting.Abstractions 8.0.0", + "Microsoft.Extensions.Caching.Memory 8.0.1", + "Microsoft.Extensions.Hosting.Abstractions 8.0.1", "NGeoNames 1.5.1", - "Microsoft.Extensions.Diagnostics.HealthChecks 8.0.8", - "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions 8.0.8", + "Microsoft.Extensions.Diagnostics.HealthChecks 8.0.10", + "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions 8.0.10", "AspNetCore.HealthChecks.MySql 8.0.1", "AspNetCore.HealthChecks.Sqlite 8.1.0", - "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore 8.0.8", + "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore 8.0.10", "MedallionShell 1.6.2", "RazorLight 2.3.1", "SixLabors.ImageSharp 3.1.5", "SixLabors.ImageSharp.Drawing 2.1.4", - "Microsoft.AspNetCore.Authorization 8.0.8", - "Microsoft.EntityFrameworkCore.Analyzers 8.0.8", - "Microsoft.EntityFrameworkCore.Design 8.0.8", - "Microsoft.EntityFrameworkCore.InMemory 8.0.8", - "Microsoft.EntityFrameworkCore.Sqlite 8.0.8", - "Microsoft.EntityFrameworkCore 8.0.8", - "Microsoft.EntityFrameworkCore.Relational 8.0.8", - "Microsoft.Extensions.DependencyInjection 8.0.0", - "Microsoft.Extensions.Identity.Stores 8.0.8", + "Microsoft.AspNetCore.Authorization 8.0.10", + "Microsoft.EntityFrameworkCore.Analyzers 8.0.10", + "Microsoft.EntityFrameworkCore.Design 8.0.10", + "Microsoft.EntityFrameworkCore.InMemory 8.0.10", + "Microsoft.EntityFrameworkCore.Sqlite 8.0.10", + "Microsoft.EntityFrameworkCore 8.0.10", + "Microsoft.EntityFrameworkCore.Relational 8.0.10", + "Microsoft.Extensions.DependencyInjection 8.0.1", + "Microsoft.Extensions.Identity.Stores 8.0.10", "Pomelo.EntityFrameworkCore.MySql 8.0.2", "System.ComponentModel.Annotations 5.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions 8.0.1", + "Microsoft.Extensions.DependencyInjection.Abstractions 8.0.2", "Microsoft.CSharp 4.7.0", "Microsoft.Extensions.Configuration 8.0.0", "Microsoft.Extensions.Configuration.Binder 8.0.2", "Microsoft.Extensions.Configuration.EnvironmentVariables 8.0.0", - "Microsoft.Extensions.Configuration.Json 8.0.0", - "Microsoft.Extensions.Logging.Abstractions 8.0.1", + "Microsoft.Extensions.Configuration.Json 8.0.1", + "Microsoft.Extensions.Logging.Abstractions 8.0.2", "System.Buffers 4.5.1", "System.Threading.Tasks.Dataflow 8.0.1", "TimeZoneConverter 6.1.0", "GeoTimeZone 5.3.0", "XmpCore 6.1.10.1", "MetadataExtractor 2.8.1", - "Microsoft.Extensions.Logging 8.0.0", - "Microsoft.Extensions.Logging.Console 8.0.0", + "Microsoft.Extensions.Logging 8.0.1", + "Microsoft.Extensions.Logging.Console 8.0.1", "OpenTelemetry 1.9.0", "OpenTelemetry.Api 1.9.0", "OpenTelemetry.Exporter.OpenTelemetryProtocol 1.9.0", @@ -50,8 +50,8 @@ "OpenTelemetry.Instrumentation.Runtime 1.9.0", "System.Diagnostics.DiagnosticSource 8.0.1", "System.Text.Json 8.0.4", - "Microsoft.AspNetCore.Identity.EntityFrameworkCore 8.0.8", - "Microsoft.Extensions.Hosting 8.0.0", + "Microsoft.AspNetCore.Identity.EntityFrameworkCore 8.0.10", + "Microsoft.Extensions.Hosting 8.0.1", "Microsoft.NET.Test.Sdk 17.11.1", "MSTest.TestAdapter 3.6.0", "MSTest.TestFramework 3.6.0", diff --git a/starsky/starsky.feature.geolookup/starsky.feature.geolookup.csproj b/starsky/starsky.feature.geolookup/starsky.feature.geolookup.csproj index 6ef123fc22..48901be140 100644 --- a/starsky/starsky.feature.geolookup/starsky.feature.geolookup.csproj +++ b/starsky/starsky.feature.geolookup/starsky.feature.geolookup.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/starsky/starsky.feature.health/starsky.feature.health.csproj b/starsky/starsky.feature.health/starsky.feature.health.csproj index 8befb222f1..f6efd9f3b0 100644 --- a/starsky/starsky.feature.health/starsky.feature.health.csproj +++ b/starsky/starsky.feature.health/starsky.feature.health.csproj @@ -15,11 +15,11 @@ - - + + - + diff --git a/starsky/starsky.feature.syncbackground/starsky.feature.syncbackground.csproj b/starsky/starsky.feature.syncbackground/starsky.feature.syncbackground.csproj index ff142a0526..ca05e352ab 100644 --- a/starsky/starsky.feature.syncbackground/starsky.feature.syncbackground.csproj +++ b/starsky/starsky.feature.syncbackground/starsky.feature.syncbackground.csproj @@ -9,7 +9,7 @@ - + diff --git a/starsky/starsky.foundation.accountmanagement/starsky.foundation.accountmanagement.csproj b/starsky/starsky.foundation.accountmanagement/starsky.foundation.accountmanagement.csproj index fd51e5d44f..633ec2648d 100644 --- a/starsky/starsky.foundation.accountmanagement/starsky.foundation.accountmanagement.csproj +++ b/starsky/starsky.foundation.accountmanagement/starsky.foundation.accountmanagement.csproj @@ -15,7 +15,7 @@ - + diff --git a/starsky/starsky.foundation.database/starsky.foundation.database.csproj b/starsky/starsky.foundation.database/starsky.foundation.database.csproj index 98c75f93ae..79a063e67e 100644 --- a/starsky/starsky.foundation.database/starsky.foundation.database.csproj +++ b/starsky/starsky.foundation.database/starsky.foundation.database.csproj @@ -13,14 +13,14 @@ - - - - - - - - + + + + + + + + diff --git a/starsky/starsky.foundation.injection/starsky.foundation.injection.csproj b/starsky/starsky.foundation.injection/starsky.foundation.injection.csproj index 8a3d357242..079f80611a 100644 --- a/starsky/starsky.foundation.injection/starsky.foundation.injection.csproj +++ b/starsky/starsky.foundation.injection/starsky.foundation.injection.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/starsky/starsky.foundation.platform/starsky.foundation.platform.csproj b/starsky/starsky.foundation.platform/starsky.foundation.platform.csproj index 2b15166f5c..26d2f35c85 100644 --- a/starsky/starsky.foundation.platform/starsky.foundation.platform.csproj +++ b/starsky/starsky.foundation.platform/starsky.foundation.platform.csproj @@ -16,13 +16,13 @@ - + - - - + + + diff --git a/starsky/starsky.foundation.readmeta/starsky.foundation.readmeta.csproj b/starsky/starsky.foundation.readmeta/starsky.foundation.readmeta.csproj index 7a7986e115..e0ab421944 100644 --- a/starsky/starsky.foundation.readmeta/starsky.foundation.readmeta.csproj +++ b/starsky/starsky.foundation.readmeta/starsky.foundation.readmeta.csproj @@ -14,7 +14,7 @@ - + diff --git a/starsky/starsky.foundation.realtime/starsky.foundation.realtime.csproj b/starsky/starsky.foundation.realtime/starsky.foundation.realtime.csproj index 18551016d9..1a687b3718 100644 --- a/starsky/starsky.foundation.realtime/starsky.foundation.realtime.csproj +++ b/starsky/starsky.foundation.realtime/starsky.foundation.realtime.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/starsky/starsky.foundation.sync/starsky.foundation.sync.csproj b/starsky/starsky.foundation.sync/starsky.foundation.sync.csproj index 12886a702c..dbf34dfb13 100644 --- a/starsky/starsky.foundation.sync/starsky.foundation.sync.csproj +++ b/starsky/starsky.foundation.sync/starsky.foundation.sync.csproj @@ -20,7 +20,7 @@ - + diff --git a/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj b/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj index 2099e778fc..ef10c0cb2b 100644 --- a/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj +++ b/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj @@ -20,11 +20,11 @@ - - - + + + - + diff --git a/starsky/starsky.foundation.worker/starsky.foundation.worker.csproj b/starsky/starsky.foundation.worker/starsky.foundation.worker.csproj index 4c5e7289a8..b7056e84bc 100644 --- a/starsky/starsky.foundation.worker/starsky.foundation.worker.csproj +++ b/starsky/starsky.foundation.worker/starsky.foundation.worker.csproj @@ -17,7 +17,7 @@ - + diff --git a/starsky/starsky.foundation.writemeta/starsky.foundation.writemeta.csproj b/starsky/starsky.foundation.writemeta/starsky.foundation.writemeta.csproj index a060f1b73b..3b6d7e9d58 100644 --- a/starsky/starsky.foundation.writemeta/starsky.foundation.writemeta.csproj +++ b/starsky/starsky.foundation.writemeta/starsky.foundation.writemeta.csproj @@ -12,7 +12,7 @@ - + diff --git a/starsky/starsky/starsky.csproj b/starsky/starsky/starsky.csproj index d857ecfd87..88795efa3a 100644 --- a/starsky/starsky/starsky.csproj +++ b/starsky/starsky/starsky.csproj @@ -1,7 +1,7 @@  net8.0 - 8.0.8 + 8.0.10 An attempt to create a database driven photo library 0.6.1 @@ -59,8 +59,8 @@ 0 - - + + diff --git a/starsky/starskyadmincli/starskyadmincli.csproj b/starsky/starskyadmincli/starskyadmincli.csproj index 3dc8d15d5d..ffbdb74add 100644 --- a/starsky/starskyadmincli/starskyadmincli.csproj +++ b/starsky/starskyadmincli/starskyadmincli.csproj @@ -5,7 +5,7 @@ net8.0 {dcf1f6cb-1c65-4394-bef7-cccc2967b56c} - 8.0.8 + 8.0.10 Full 0.6.1 enable diff --git a/starsky/starskydemoseedcli/starskydemoseedcli.csproj b/starsky/starskydemoseedcli/starskydemoseedcli.csproj index b3f47ef8d1..801d14dc2c 100644 --- a/starsky/starskydemoseedcli/starskydemoseedcli.csproj +++ b/starsky/starskydemoseedcli/starskydemoseedcli.csproj @@ -5,7 +5,7 @@ enable {215a3302-a418-4148-8d20-1127e27c3dae} - 8.0.8 + 8.0.10 Full 0.6.1 enable diff --git a/starsky/starskygeocli/starskygeocli.csproj b/starsky/starskygeocli/starskygeocli.csproj index a9ce34d224..4e9edcabe0 100644 --- a/starsky/starskygeocli/starskygeocli.csproj +++ b/starsky/starskygeocli/starskygeocli.csproj @@ -5,7 +5,7 @@ enable {a030c158-2f79-4317-a9f9-bdd46d66d1d8} - 8.0.8 + 8.0.10 Full 0.6.1 enable diff --git a/starsky/starskyimportercli/starskyimportercli.csproj b/starsky/starskyimportercli/starskyimportercli.csproj index 7c9f6034d6..65fb2733dc 100644 --- a/starsky/starskyimportercli/starskyimportercli.csproj +++ b/starsky/starskyimportercli/starskyimportercli.csproj @@ -4,7 +4,7 @@ net8.0 {23e4ea86-970a-4de1-badc-8d7e9d3d4dd6} - 8.0.8 + 8.0.10 Full 0.6.1 enable diff --git a/starsky/starskysynchronizecli/starskysynchronizecli.csproj b/starsky/starskysynchronizecli/starskysynchronizecli.csproj index f76dcf0281..60f0aaf540 100644 --- a/starsky/starskysynchronizecli/starskysynchronizecli.csproj +++ b/starsky/starskysynchronizecli/starskysynchronizecli.csproj @@ -5,7 +5,7 @@ net8.0 {7e1136a7-cc43-49d2-91d3-48e557f0fb66} - 8.0.8 + 8.0.10 starskysynchronizecli 0.6.1 enable diff --git a/starsky/starskytest/starskytest.csproj b/starsky/starskytest/starskytest.csproj index 09a4fd9981..27fbc5de4b 100644 --- a/starsky/starskytest/starskytest.csproj +++ b/starsky/starskytest/starskytest.csproj @@ -1,7 +1,7 @@  net8.0 - 8.0.8 + 8.0.10 Full {b3342a3e-64e1-442f-b4f7-f7a718508aac} @@ -21,10 +21,10 @@ - - - - + + + + diff --git a/starsky/starskythumbnailcli/starskythumbnailcli.csproj b/starsky/starskythumbnailcli/starskythumbnailcli.csproj index f061e61cc4..b1ec12039b 100644 --- a/starsky/starskythumbnailcli/starskythumbnailcli.csproj +++ b/starsky/starskythumbnailcli/starskythumbnailcli.csproj @@ -5,7 +5,7 @@ net8.0 {67e3fb34-1ca8-4a28-a0e0-00ff61821002} - 8.0.8 + 8.0.10 starskythumbnailcli 0.6.1 enable diff --git a/starsky/starskythumbnailmetacli/starskythumbnailmetacli.csproj b/starsky/starskythumbnailmetacli/starskythumbnailmetacli.csproj index af2888d69e..5fcde5cfc0 100644 --- a/starsky/starskythumbnailmetacli/starskythumbnailmetacli.csproj +++ b/starsky/starskythumbnailmetacli/starskythumbnailmetacli.csproj @@ -5,7 +5,7 @@ net8.0 {a0cce905-ae43-4d1b-a97a-2bcd2c010ed1} - 8.0.8 + 8.0.10 starskythumbnailmetacli 0.6.1 enable diff --git a/starsky/starskywebftpcli/starskywebftpcli.csproj b/starsky/starskywebftpcli/starskywebftpcli.csproj index 4a08c5a22d..1fa86ab009 100644 --- a/starsky/starskywebftpcli/starskywebftpcli.csproj +++ b/starsky/starskywebftpcli/starskywebftpcli.csproj @@ -4,7 +4,7 @@ Exe net8.0 {eb1d57d1-29d8-4bfb-950e-447ef8522a10} - 8.0.8 + 8.0.10 Full 0.6.1 enable diff --git a/starsky/starskywebhtmlcli/starskywebhtmlcli.csproj b/starsky/starskywebhtmlcli/starskywebhtmlcli.csproj index c1bc6de436..68f07aaafa 100644 --- a/starsky/starskywebhtmlcli/starskywebhtmlcli.csproj +++ b/starsky/starskywebhtmlcli/starskywebhtmlcli.csproj @@ -3,7 +3,7 @@ Exe net8.0 {76d7bf62-9f1d-48f1-9035-dceb01de55c3} - 8.0.8 + 8.0.10 8.0 true Full From dca8a3de77a14ba0606c2daa3639cc7573973d6b Mon Sep 17 00:00:00 2001 From: Dion Date: Thu, 10 Oct 2024 10:48:29 +0200 Subject: [PATCH 2/5] breaking change in internals memory cache --- .../Extensions/MemoryCacheExtensions.cs | 94 ++++++++++--------- .../Extensions/MemoryCacheExtensionsTest.cs | 65 +++++++------ 2 files changed, 81 insertions(+), 78 deletions(-) diff --git a/starsky/starsky.foundation.platform/Extensions/MemoryCacheExtensions.cs b/starsky/starsky.foundation.platform/Extensions/MemoryCacheExtensions.cs index 5d2b96b69c..0c3964aa3f 100644 --- a/starsky/starsky.foundation.platform/Extensions/MemoryCacheExtensions.cs +++ b/starsky/starsky.foundation.platform/Extensions/MemoryCacheExtensions.cs @@ -7,60 +7,64 @@ using System.Reflection.Emit; using Microsoft.Extensions.Caching.Memory; -namespace starsky.foundation.platform.Extensions +namespace starsky.foundation.platform.Extensions; + +/// +/// @see: https://stackoverflow.com/a/64291008 +/// +[SuppressMessage("Usage", "S3011:Make sure that this accessibility bypass is safe here", + Justification = "Safe")] +public static class MemoryCacheExtensions { + private static readonly Lazy>? GetCoherentState = + new(() => + CreateGetter(typeof(MemoryCache) + .GetField("_coherentState", BindingFlags.NonPublic | BindingFlags.Instance)!)); + /// - /// @see: https://stackoverflow.com/a/64291008 + /// https://github.com/dotnet/runtime/blob/81cabf2857a01351e5ab578947c7403a5b128ad1/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs#L680C1-L681C85 /// - [SuppressMessage("Usage", "S3011:Make sure that this accessibility bypass is safe here", Justification = "Safe")] - public static class MemoryCacheExtensions + private static readonly Lazy> GetEntries7 = + new(() => + CreateGetter(typeof(MemoryCache) + .GetNestedType("CoherentState", BindingFlags.NonPublic)? + .GetField("_stringEntries", BindingFlags.NonPublic | BindingFlags.Instance)!)); + + private static readonly Func GetEntries = + cache => GetEntries7.Value(GetCoherentState.Value(cache)); + + private static Func CreateGetter(FieldInfo field) { - private static readonly Lazy>? GetCoherentState = - new(() => - CreateGetter(typeof(MemoryCache) - .GetField("_coherentState", BindingFlags.NonPublic | BindingFlags.Instance)!)); + var methodName = $"{field.ReflectedType?.FullName}.get_{field.Name}"; + var method = new DynamicMethod(methodName, typeof(TReturn), new[] { typeof(TParam) }, + typeof(TParam), true); + var ilGen = method.GetILGenerator(); + ilGen.Emit(OpCodes.Ldarg_0); + ilGen.Emit(OpCodes.Ldfld, field); + ilGen.Emit(OpCodes.Ret); + return ( Func ) method.CreateDelegate(typeof(Func)); + } - private static readonly Lazy> GetEntries7 = - new(() => - CreateGetter(typeof(MemoryCache) - .GetNestedType("CoherentState", BindingFlags.NonPublic)? - .GetField("_entries", BindingFlags.NonPublic | BindingFlags.Instance)!)); + private static ICollection GetKeys(this IMemoryCache memoryCache) + { + return GetEntries(( MemoryCache ) memoryCache).Keys; + } - private static Func CreateGetter(FieldInfo field) + /// + /// Get Keys + /// + /// memory cache + /// bind as + /// list of items + public static IEnumerable GetKeys(this IMemoryCache memoryCache) + { + try { - var methodName = $"{field.ReflectedType?.FullName}.get_{field.Name}"; - var method = new DynamicMethod(methodName, typeof(TReturn), new[] { typeof(TParam) }, typeof(TParam), true); - var ilGen = method.GetILGenerator(); - ilGen.Emit(OpCodes.Ldarg_0); - ilGen.Emit(OpCodes.Ldfld, field); - ilGen.Emit(OpCodes.Ret); - return ( Func ) method.CreateDelegate(typeof(Func)); + return GetKeys(memoryCache).OfType(); } - - private static readonly Func GetEntries = - cache => GetEntries7.Value(GetCoherentState.Value(cache)); - - private static ICollection GetKeys(this IMemoryCache memoryCache) => - GetEntries(( MemoryCache ) memoryCache).Keys; - - /// - /// Get Keys - /// - /// memory cache - /// bind as - /// list of items - public static IEnumerable GetKeys(this IMemoryCache memoryCache) + catch ( InvalidCastException ) { - try - { - return GetKeys(memoryCache).OfType(); - } - catch ( InvalidCastException ) - { - return new List(); - } + return new List(); } - - } } diff --git a/starsky/starskytest/starsky.foundation.platform/Extensions/MemoryCacheExtensionsTest.cs b/starsky/starskytest/starsky.foundation.platform/Extensions/MemoryCacheExtensionsTest.cs index a916739639..e54d380df5 100644 --- a/starsky/starskytest/starsky.foundation.platform/Extensions/MemoryCacheExtensionsTest.cs +++ b/starsky/starskytest/starsky.foundation.platform/Extensions/MemoryCacheExtensionsTest.cs @@ -5,43 +5,42 @@ using starsky.foundation.platform.Extensions; using starskytest.FakeMocks; -namespace starskytest.starsky.foundation.platform.Extensions +namespace starskytest.starsky.foundation.platform.Extensions; + +[TestClass] +public sealed class MemoryCacheExtensionsTest { - [TestClass] - public sealed class MemoryCacheExtensionsTest + [TestMethod] + public void MemoryCacheExtensions_NoContentInCache() { - [TestMethod] - public void NoContentInCache() - { - var provider = new ServiceCollection() - .AddMemoryCache(); + var provider = new ServiceCollection() + .AddMemoryCache(); + + var buildServiceProvider = provider.BuildServiceProvider(); + var memoryCache = buildServiceProvider.GetService(); + var keys = memoryCache?.GetKeys(); + Assert.AreEqual(0, keys?.Count()); + } - var buildServiceProvider = provider.BuildServiceProvider(); - var memoryCache = buildServiceProvider.GetService(); - var keys= memoryCache?.GetKeys(); - Assert.AreEqual(0, keys?.Count()); - } - - [TestMethod] - public void OneItemInCache() - { - var provider = new ServiceCollection() - .AddMemoryCache(); + [TestMethod] + public void MemoryCacheExtensions_OneItemInCache() + { + var provider = new ServiceCollection() + .AddMemoryCache(); - var buildServiceProvider = provider.BuildServiceProvider(); - var memoryCache = buildServiceProvider.GetService(); - memoryCache?.Set("test", ""); - var keys= memoryCache?.GetKeys().ToList(); - Assert.AreEqual(1, keys?.Count); - Assert.AreEqual("test", keys?[0]); - } + var buildServiceProvider = provider.BuildServiceProvider(); + var memoryCache = buildServiceProvider.GetService(); + memoryCache?.Set("test", ""); + var keys = memoryCache?.GetKeys().ToList(); + Assert.AreEqual(1, keys?.Count); + Assert.AreEqual("test", keys?[0]); + } - [TestMethod] - public void FakeCache_Invalid() - { - var cache = new FakeMemoryCache(); - var keys= cache.GetKeys().ToList(); - Assert.AreEqual(0, keys.Count); - } + [TestMethod] + public void FakeCache_Invalid() + { + var cache = new FakeMemoryCache(); + var keys = cache.GetKeys().ToList(); + Assert.AreEqual(0, keys.Count); } } From bc1a26b749ead43d36b980960c32f095a66a8edd Mon Sep 17 00:00:00 2001 From: Dion van Velde Date: Thu, 10 Oct 2024 10:49:52 +0200 Subject: [PATCH 3/5] Update history.md --- history.md | 1 + 1 file changed, 1 insertion(+) diff --git a/history.md b/history.md index f4a3fe3899..b022b7bb92 100644 --- a/history.md +++ b/history.md @@ -51,6 +51,7 @@ Semantic Versioning 2.0.0 is from version 0.1.6+ - [x] (Changed) _Back-end_ Fixed models for replace (PR #1740) - [x] (Changed) _Tools_ Update cypress and eslint to 9 (PR #1740) - [x] (Changed) _Front-end_ Make more properties readonly for internal security (PR #1740) +- [x] (Changed) _Back-end_ Upgrade to .NET 8 - SDK 8.0.403 (Runtime: 8.0.10) (PR #1751) ## version 0.6.1 - 2024-05-16 {#v0.6.1} From 0956f91015d21daac21918bff1062e39204c0b45 Mon Sep 17 00:00:00 2001 From: Dion van Velde Date: Thu, 10 Oct 2024 10:50:13 +0200 Subject: [PATCH 4/5] Update readme.md --- starsky/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starsky/readme.md b/starsky/readme.md index b2f0589fb8..8ac28fa906 100644 --- a/starsky/readme.md +++ b/starsky/readme.md @@ -37,7 +37,7 @@ to compile the application for development git clone "https://github.com/qdraw/starsky.git" ``` -2. Get the `dotnet` 8.0.302 SDK. To get the 'Build apps - SDK' .NET Core from https://www.microsoft.com/net/download or https://versionsof.net/ +2. Get the `dotnet` 8.0.403 SDK. To get the 'Build apps - SDK' .NET Core from https://www.microsoft.com/net/download or https://versionsof.net/ 3. Get a recent version of nodejs (20.x or newer) 4. Make a build of all the projects and run the tests From 1e07a3a85f6ad93defe35d9c1b54055f1eb3bd91 Mon Sep 17 00:00:00 2001 From: Dion Date: Thu, 10 Oct 2024 11:36:00 +0200 Subject: [PATCH 5/5] update nuget packages --- starsky/build/_build.csproj | 2 +- .../starsky.foundation.webtelemetry.csproj | 2 +- starsky/starskytest/starskytest.csproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/starsky/build/_build.csproj b/starsky/build/_build.csproj index 6636a618d2..83439605d4 100644 --- a/starsky/build/_build.csproj +++ b/starsky/build/_build.csproj @@ -16,7 +16,7 @@ - + diff --git a/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj b/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj index ef10c0cb2b..1f151e23b7 100644 --- a/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj +++ b/starsky/starsky.foundation.webtelemetry/starsky.foundation.webtelemetry.csproj @@ -33,7 +33,7 @@ - + diff --git a/starsky/starskytest/starskytest.csproj b/starsky/starskytest/starskytest.csproj index 27fbc5de4b..2f12ef40d6 100644 --- a/starsky/starskytest/starskytest.csproj +++ b/starsky/starskytest/starskytest.csproj @@ -26,8 +26,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive