Skip to content

Commit

Permalink
Merge pull request #1751 from qdraw/feature/auto_dotnet_sdk_version_u…
Browse files Browse the repository at this point in the history
…pgrade_8.0.403

.NET SDK Upgrade to 8.0.403
  • Loading branch information
qdraw authored Oct 10, 2024
2 parents c7b1dba + 1e07a3a commit 6a76911
Show file tree
Hide file tree
Showing 39 changed files with 168 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/desktop-release-on-tag-net-electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webapp-build-net-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webapp-build-net-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webapp-build-net-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webapp-codecov-clientapp-netcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webapp-sonarqube-clientapp-netcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webapp-update-swagger-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions history.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
4 changes: 2 additions & 2 deletions pipelines/azure/steps/use_dotnet_version.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion starsky/build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0"/>
<PackageReference Include="Nuke.Common" Version="8.1.0" />
<PackageReference Include="Nuke.Common" Version="8.1.1" />
<PackageReference Include="ReportGenerator.Core" Version="5.2.5" />
<PackageReference Include="SimpleExec" Version="12.0.0"/>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion starsky/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"strictVersion": true,
"sdk": {
"version": "8.0.402",
"version": "8.0.403",
"rollForward": "disable",
"allowPrerelease": false
}
Expand Down
46 changes: 23 additions & 23 deletions starsky/nuget-packages-list.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion starsky/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="NGeoNames" Version="1.5.1"/>
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions starsky/starsky.feature.health/starsky.feature.health.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="8.0.10" />
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="8.0.1"/>
<PackageReference Include="AspNetCore.HealthChecks.Sqlite" Version="8.1.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.10" />
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.10" />
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<!-- instead of : Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0, -->
<!-- Microsoft.AspNetCore.Authentication-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.10" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2"/>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0"/>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
</ItemGroup>

<PropertyGroup Condition=" '$(noSonar)' == 'true' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,64 @@
using System.Reflection.Emit;
using Microsoft.Extensions.Caching.Memory;

namespace starsky.foundation.platform.Extensions
namespace starsky.foundation.platform.Extensions;

/// <summary>
/// @see: https://stackoverflow.com/a/64291008
/// </summary>
[SuppressMessage("Usage", "S3011:Make sure that this accessibility bypass is safe here",
Justification = "Safe")]
public static class MemoryCacheExtensions
{
private static readonly Lazy<Func<MemoryCache, object>>? GetCoherentState =
new(() =>
CreateGetter<MemoryCache, object>(typeof(MemoryCache)
.GetField("_coherentState", BindingFlags.NonPublic | BindingFlags.Instance)!));

/// <summary>
/// @see: https://stackoverflow.com/a/64291008
/// https://github.com/dotnet/runtime/blob/81cabf2857a01351e5ab578947c7403a5b128ad1/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs#L680C1-L681C85
/// </summary>
[SuppressMessage("Usage", "S3011:Make sure that this accessibility bypass is safe here", Justification = "Safe")]
public static class MemoryCacheExtensions
private static readonly Lazy<Func<object, IDictionary>> GetEntries7 =
new(() =>
CreateGetter<object, IDictionary>(typeof(MemoryCache)
.GetNestedType("CoherentState", BindingFlags.NonPublic)?
.GetField("_stringEntries", BindingFlags.NonPublic | BindingFlags.Instance)!));

private static readonly Func<MemoryCache, IDictionary> GetEntries =
cache => GetEntries7.Value(GetCoherentState.Value(cache));

private static Func<TParam, TReturn> CreateGetter<TParam, TReturn>(FieldInfo field)
{
private static readonly Lazy<Func<MemoryCache, object>>? GetCoherentState =
new(() =>
CreateGetter<MemoryCache, object>(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<TParam, TReturn> ) method.CreateDelegate(typeof(Func<TParam, TReturn>));
}

private static readonly Lazy<Func<object, IDictionary>> GetEntries7 =
new(() =>
CreateGetter<object, IDictionary>(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<TParam, TReturn> CreateGetter<TParam, TReturn>(FieldInfo field)
/// <summary>
/// Get Keys
/// </summary>
/// <param name="memoryCache">memory cache</param>
/// <typeparam name="T">bind as</typeparam>
/// <returns>list of items</returns>
public static IEnumerable<T> GetKeys<T>(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<TParam, TReturn> ) method.CreateDelegate(typeof(Func<TParam, TReturn>));
return GetKeys(memoryCache).OfType<T>();
}

private static readonly Func<MemoryCache, IDictionary> GetEntries =
cache => GetEntries7.Value(GetCoherentState.Value(cache));

private static ICollection GetKeys(this IMemoryCache memoryCache) =>
GetEntries(( MemoryCache ) memoryCache).Keys;

/// <summary>
/// Get Keys
/// </summary>
/// <param name="memoryCache">memory cache</param>
/// <typeparam name="T">bind as</typeparam>
/// <returns>list of items</returns>
public static IEnumerable<T> GetKeys<T>(this IMemoryCache memoryCache)
catch ( InvalidCastException )
{
try
{
return GetKeys(memoryCache).OfType<T>();
}
catch ( InvalidCastException )
{
return new List<T>();
}
return new List<T>();
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<!-- instead of : Microsoft.AspNetCore.Http.Abstractions" 2.2.0 -->
<PackageReference Include="Microsoft.CSharp" Version="4.7.0"/>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="System.Buffers" Version="4.5.1"/>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0"/>
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="8.0.1" />
Expand Down
Loading

0 comments on commit 6a76911

Please sign in to comment.