diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 436c66fadd..bbd8af9bae 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2026.2.1", + "version": "2026.3.0-eap05", "commands": [ "jb" ], diff --git a/.github/workflows/Steeltoe.All.yml b/.github/workflows/Steeltoe.All.yml index 12b5e92a2b..bade282d26 100644 --- a/.github/workflows/Steeltoe.All.yml +++ b/.github/workflows/Steeltoe.All.yml @@ -68,10 +68,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: | - 8.0.* - 9.0.* - 10.0.* + dotnet-version: 10.0.* + + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview - name: Turn off dev certificate (macOS only) if: ${{ matrix.os == 'macos-latest' }} diff --git a/.github/workflows/component-shared-workflow.yml b/.github/workflows/component-shared-workflow.yml index b03a49315f..7e18a321fb 100644 --- a/.github/workflows/component-shared-workflow.yml +++ b/.github/workflows/component-shared-workflow.yml @@ -58,10 +58,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: | - 8.0.* - 9.0.* - 10.0.* + dotnet-version: 10.0.* + + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview - name: Turn off dev certificate (macOS only) if: ${{ inputs.OS == 'macos' }} diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index e302639d32..ee15354739 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -34,10 +34,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: | - 8.0.* - 9.0.* - 10.0.* + dotnet-version: 10.0.* + + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview - name: Git checkout uses: actions/checkout@v7 @@ -151,6 +154,12 @@ jobs: with: dotnet-version: 10.0.* + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview + - name: Install code signing tool run: dotnet tool install --global sign --prerelease @@ -214,6 +223,15 @@ jobs: env: NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview + source-url: ${{ vars.AZURE_ARTIFACTS_FEED_URL }} + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install credential provider for Azure Artifacts run: sh -c "$(curl -fsSL https://aka.ms/install-artifacts-credprovider.sh)" @@ -244,6 +262,12 @@ jobs: with: dotnet-version: 10.0.* + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview + - name: Download signed packages uses: actions/download-artifact@v8 with: diff --git a/.github/workflows/scan-vulnerable-dependencies.yml b/.github/workflows/scan-vulnerable-dependencies.yml index ff7f4da03f..0db7a483ad 100644 --- a/.github/workflows/scan-vulnerable-dependencies.yml +++ b/.github/workflows/scan-vulnerable-dependencies.yml @@ -30,10 +30,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: | - 8.0.* - 9.0.* - 10.0.* + dotnet-version: 10.0.* + + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview - name: Git checkout uses: actions/checkout@v7 diff --git a/.github/workflows/sonarcube.yml b/.github/workflows/sonarcube.yml index 4756bf118a..9c113b8c71 100644 --- a/.github/workflows/sonarcube.yml +++ b/.github/workflows/sonarcube.yml @@ -59,10 +59,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: | - 8.0.* - 9.0.* - 10.0.* + dotnet-version: 10.0.* + + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview - name: Install Sonar .NET Scanner run: dotnet tool install --global dotnet-sonarscanner diff --git a/.github/workflows/verify-code-style.yml b/.github/workflows/verify-code-style.yml index b55281c0ff..3d4ec4fc69 100644 --- a/.github/workflows/verify-code-style.yml +++ b/.github/workflows/verify-code-style.yml @@ -29,10 +29,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: | - 8.0.* - 9.0.* - 10.0.* + dotnet-version: 10.0.* + + - name: Setup .NET 11 Preview + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 11.0.* + dotnet-quality: preview - name: Git checkout uses: actions/checkout@v7 diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000000..992222eab2 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,14 @@ + + + + + true + + + $(NoWarn);NU1608 + + + + + + diff --git a/README.md b/README.md index cdd0c1db15..7cfc9f6ee2 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ In addition to the [feature documentation](https://steeltoe.io/api), we have bui | Steeltoe Branch | .NET Version | Status | | --- | --- | --- | -| main | .NET 8 - 10 | Unstable | +| main | .NET 10 - 11 | Unstable | | 4.x | .NET 8 - 10 | Stable | | 3.x | .NET 8 | Stable | | 2.x | .NET Framework 4.6.1+ | Out of Support | diff --git a/shared.props b/shared.props index 1e521d95a8..8e7976b60a 100644 --- a/shared.props +++ b/shared.props @@ -20,10 +20,8 @@ $(NoWarn);IDE0051;IDE0052 - - + + $(NoWarn);ASPDEPR004;ASPDEPR008 diff --git a/src/Bootstrap/src/AutoConfiguration/Steeltoe.Bootstrap.AutoConfiguration.csproj b/src/Bootstrap/src/AutoConfiguration/Steeltoe.Bootstrap.AutoConfiguration.csproj index 677a96c46d..6692540a99 100644 --- a/src/Bootstrap/src/AutoConfiguration/Steeltoe.Bootstrap.AutoConfiguration.csproj +++ b/src/Bootstrap/src/AutoConfiguration/Steeltoe.Bootstrap.AutoConfiguration.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Automatically configure Steeltoe packages that are referenced by a project. This is not a meta package, other packages must be added separately. autoconfiguration;automatic;configuration;application;bootstrapping;starter true diff --git a/src/Bootstrap/test/AutoConfiguration.Test/Steeltoe.Bootstrap.AutoConfiguration.Test.csproj b/src/Bootstrap/test/AutoConfiguration.Test/Steeltoe.Bootstrap.AutoConfiguration.Test.csproj index eee10bda4b..0cb5a3d6b0 100644 --- a/src/Bootstrap/test/AutoConfiguration.Test/Steeltoe.Bootstrap.AutoConfiguration.Test.csproj +++ b/src/Bootstrap/test/AutoConfiguration.Test/Steeltoe.Bootstrap.AutoConfiguration.Test.csproj @@ -1,6 +1,6 @@ - net10.0;net9.0;net8.0 + net11.0;net10.0 @@ -12,7 +12,7 @@ - + diff --git a/src/Bootstrap/test/EmptyAutoConfiguration.Test/Steeltoe.Bootstrap.EmptyAutoConfiguration.Test.csproj b/src/Bootstrap/test/EmptyAutoConfiguration.Test/Steeltoe.Bootstrap.EmptyAutoConfiguration.Test.csproj index 8b5c6233b2..101ae9a0a2 100644 --- a/src/Bootstrap/test/EmptyAutoConfiguration.Test/Steeltoe.Bootstrap.EmptyAutoConfiguration.Test.csproj +++ b/src/Bootstrap/test/EmptyAutoConfiguration.Test/Steeltoe.Bootstrap.EmptyAutoConfiguration.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Common/src/Certificates/ConfigureCertificateOptions.cs b/src/Common/src/Certificates/ConfigureCertificateOptions.cs index 74719c8f1e..80cca0132b 100644 --- a/src/Common/src/Certificates/ConfigureCertificateOptions.cs +++ b/src/Common/src/Certificates/ConfigureCertificateOptions.cs @@ -70,16 +70,10 @@ public void Configure(string? name, CertificateOptions options) private static X509Certificate2 LoadCertificate(string certificateFilePath, bool isPkcs12) { -#if NET9_0_OR_GREATER // LoadCertificateFromFile handles PEM and DER but not PKCS#12; .pfx/.p12 need a separate loader. return isPkcs12 ? X509CertificateLoader.LoadPkcs12FromFile(certificateFilePath, null) : X509CertificateLoader.LoadCertificateFromFile(certificateFilePath); -#else - // This code path does not need to know if the certificate is PKCS12. - _ = isPkcs12; - return new X509Certificate2(certificateFilePath); -#endif } private static X509Certificate2 LoadCertificateWithKey(string certificateFilePath, string privateKeyFilePath) @@ -91,11 +85,7 @@ private static X509Certificate2 LoadCertificateWithKey(string certificateFilePat // See https://learn.microsoft.com/dotnet/core/extensions/sslstream-troubleshooting using var certificate = X509Certificate2.CreateFromPemFile(certificateFilePath, privateKeyFilePath); byte[] pkcs12Bytes = certificate.Export(X509ContentType.Pkcs12); -#if NET9_0_OR_GREATER return X509CertificateLoader.LoadPkcs12(pkcs12Bytes, null, X509KeyStorageFlags.UserKeySet); -#else - return new X509Certificate2(pkcs12Bytes, (string?)null, X509KeyStorageFlags.UserKeySet); -#endif } return X509Certificate2.CreateFromPemFile(certificateFilePath, privateKeyFilePath); @@ -106,12 +96,8 @@ private static X509Certificate2Collection LoadIssuerChainFromPkcs12(string certi // PKCS#12 does not guarantee certificate ordering, so the leaf cannot be identified by position. // The leaf thumbprint is used to exclude it; all other certificates are chain members. var issuerChain = new X509Certificate2Collection(); -#if NET9_0_OR_GREATER X509Certificate2Collection fullCertificateChain = X509CertificateLoader.LoadPkcs12CollectionFromFile(certificateFilePath, null); -#else - var fullCertificateChain = new X509Certificate2Collection(); - fullCertificateChain.Import(certificateFilePath); -#endif + foreach (X509Certificate2 certificate in fullCertificateChain) { if (certificate.Thumbprint != skipThumbprint) diff --git a/src/Common/src/Certificates/LocalCertificateWriter.cs b/src/Common/src/Certificates/LocalCertificateWriter.cs index 8729aa6276..22ddb53b17 100644 --- a/src/Common/src/Certificates/LocalCertificateWriter.cs +++ b/src/Common/src/Certificates/LocalCertificateWriter.cs @@ -38,7 +38,7 @@ private static string GetAppBasePath() { if (AppContext.BaseDirectory.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}", StringComparison.Ordinal)) { - // Traverse up to the project directory, if running from IDE. Strips off a sub-path like: \bin\Debug\net8.0\win-x64\ + // Traverse up to the project directory, if running from IDE. Strips off a sub-path like: \bin\Debug\net10.0\win-x64\ return AppContext.BaseDirectory[..AppContext.BaseDirectory.LastIndexOf($"{Path.DirectorySeparatorChar}bin", StringComparison.Ordinal)]; } @@ -69,11 +69,7 @@ public void Write(Guid orgId, Guid spaceId) } else { -#if NET9_0_OR_GREATER caCertificate = X509CertificateLoader.LoadPkcs12FromFile(RootCaSigningPfxPath, null); -#else - caCertificate = new X509Certificate2(RootCaSigningPfxPath); -#endif } File.WriteAllText(RootCaCrtPath, caCertificate.ExportCertificatePem()); @@ -88,11 +84,7 @@ public void Write(Guid orgId, Guid spaceId) } else { -#if NET9_0_OR_GREATER intermediateCertificate = X509CertificateLoader.LoadPkcs12FromFile(IntermediateSigningPfxPath, null); -#else - intermediateCertificate = new X509Certificate2(IntermediateSigningPfxPath); -#endif } File.WriteAllText(IntermediateCrtPath, intermediateCertificate.ExportCertificatePem()); diff --git a/src/Common/src/Certificates/Steeltoe.Common.Certificates.csproj b/src/Common/src/Certificates/Steeltoe.Common.Certificates.csproj index 9ed450c61d..1bce25a17d 100644 --- a/src/Common/src/Certificates/Steeltoe.Common.Certificates.csproj +++ b/src/Common/src/Certificates/Steeltoe.Common.Certificates.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Steeltoe shared library for working with certificates. security;pem;certificate true diff --git a/src/Common/src/Common/Extensions/MaskedUri.cs b/src/Common/src/Common/Extensions/MaskedUri.cs index 7b1500716b..146a23c0df 100644 --- a/src/Common/src/Common/Extensions/MaskedUri.cs +++ b/src/Common/src/Common/Extensions/MaskedUri.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.Collections.Specialized; using System.Web; -#if NET9_0_OR_GREATER -using System.Buffers; -#endif namespace Steeltoe.Common.Extensions; @@ -33,11 +31,9 @@ internal readonly record struct MaskedUri "cert" ]; -#if NET9_0_OR_GREATER private static readonly SearchValues SensitiveQueryStringParameterNameSearchValues = // Vectorized, case-insensitive multi-substring search: much faster than looping over SensitiveQueryStringParameterNameParts per parameter name. SearchValues.Create(SensitiveQueryStringParameterNameParts, StringComparison.OrdinalIgnoreCase); -#endif private readonly Uri? _value; @@ -116,19 +112,7 @@ internal static Uri Mask(Uri source) private static bool IsSensitiveParameterName(string parameterName) { -#if NET9_0_OR_GREATER return parameterName.AsSpan().ContainsAny(SensitiveQueryStringParameterNameSearchValues); -#else - foreach (string namePart in SensitiveQueryStringParameterNameParts) - { - if (parameterName.Contains(namePart, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - - return false; -#endif } public static implicit operator MaskedUri(Uri? uri) diff --git a/src/Common/src/Common/ServiceDescriptorExtensions.cs b/src/Common/src/Common/ServiceDescriptorExtensions.cs deleted file mode 100644 index 7977787bae..0000000000 --- a/src/Common/src/Common/ServiceDescriptorExtensions.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using Microsoft.Extensions.DependencyInjection; - -namespace Steeltoe.Common; - -/// -/// Provides a workaround for https://github.com/dotnet/runtime/issues/95789. This breaking change was patched in later .NET 8 versions, but users may -/// still be using an old version. -/// -internal static class ServiceDescriptorExtensions -{ - public static Type? SafeGetImplementationType(this ServiceDescriptor descriptor) - { - return descriptor.IsKeyedService ? descriptor.KeyedImplementationType : descriptor.ImplementationType; - } - - public static object? SafeGetImplementationInstance(this ServiceDescriptor descriptor) - { - return descriptor.IsKeyedService ? descriptor.KeyedImplementationInstance : descriptor.ImplementationInstance; - } -} diff --git a/src/Common/src/Common/Steeltoe.Common.csproj b/src/Common/src/Common/Steeltoe.Common.csproj index 5df742c940..74b8f873f6 100644 --- a/src/Common/src/Common/Steeltoe.Common.csproj +++ b/src/Common/src/Common/Steeltoe.Common.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Abstractions and code shared by many Steeltoe components. common;utility true @@ -13,6 +13,5 @@ - diff --git a/src/Common/src/Hosting/Steeltoe.Common.Hosting.csproj b/src/Common/src/Hosting/Steeltoe.Common.Hosting.csproj index 329b5c48bb..6e96fa24b5 100644 --- a/src/Common/src/Hosting/Steeltoe.Common.Hosting.csproj +++ b/src/Common/src/Hosting/Steeltoe.Common.Hosting.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Steeltoe library for commonly-used ASP.NET Core hosting-related functions. hosting true diff --git a/src/Common/src/Http/HttpClientExtensions.cs b/src/Common/src/Http/HttpClientExtensions.cs index 9888094f25..b091acb600 100644 --- a/src/Common/src/Http/HttpClientExtensions.cs +++ b/src/Common/src/Http/HttpClientExtensions.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Net.Http.Headers; -using System.Net.Http.Json; using System.Reflection; using System.Text; using System.Text.Json.Serialization; diff --git a/src/Common/src/Http/Steeltoe.Common.Http.csproj b/src/Common/src/Http/Steeltoe.Common.Http.csproj index 0a6b1fbc0c..75ae97288a 100644 --- a/src/Common/src/Http/Steeltoe.Common.Http.csproj +++ b/src/Common/src/Http/Steeltoe.Common.Http.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Shared code related to HTTP, primarily for working with HttpClient. http true @@ -8,11 +8,6 @@ - - - - - diff --git a/src/Common/src/Logging/BootstrapLoggerFactory.cs b/src/Common/src/Logging/BootstrapLoggerFactory.cs index 4f5c96ddd1..d1a91c8b8c 100644 --- a/src/Common/src/Logging/BootstrapLoggerFactory.cs +++ b/src/Common/src/Logging/BootstrapLoggerFactory.cs @@ -4,13 +4,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using LockPrimitive = -#if NET10_0_OR_GREATER - System.Threading.Lock -#else - object -#endif - ; namespace Steeltoe.Common.Logging; @@ -35,7 +28,7 @@ public sealed class BootstrapLoggerFactory : ILoggerFactory loggingBuilder.AddConfiguration(configuration); }; - private readonly LockPrimitive _lock = new(); + private readonly Lock _lock = new(); private readonly Dictionary _loggersByCategoryName = []; private ILoggerFactory _innerFactory; diff --git a/src/Common/src/Logging/Steeltoe.Common.Logging.csproj b/src/Common/src/Logging/Steeltoe.Common.Logging.csproj index 43274bcead..ba24fb0786 100644 --- a/src/Common/src/Logging/Steeltoe.Common.Logging.csproj +++ b/src/Common/src/Logging/Steeltoe.Common.Logging.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Abstractions and code for bootstrap logging, before the IoC container is built. Bootstrap logging is replaced by the runtime logging (what the rest of your application is using) after the IoC container is built. bootstrap;logging true diff --git a/src/Common/src/Net/Steeltoe.Common.Net.csproj b/src/Common/src/Net/Steeltoe.Common.Net.csproj index 89b4174c1e..955e9959c6 100644 --- a/src/Common/src/Net/Steeltoe.Common.Net.csproj +++ b/src/Common/src/Net/Steeltoe.Common.Net.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Abstractions and code for using Windows network files shares. Windows-file-sharing;SMB;CIFS true diff --git a/src/Common/test/Certificates.Test/Steeltoe.Common.Certificates.Test.csproj b/src/Common/test/Certificates.Test/Steeltoe.Common.Certificates.Test.csproj index 3397fd9de8..36a292323a 100644 --- a/src/Common/test/Certificates.Test/Steeltoe.Common.Certificates.Test.csproj +++ b/src/Common/test/Certificates.Test/Steeltoe.Common.Certificates.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Common/test/Common.Test/Steeltoe.Common.Test.csproj b/src/Common/test/Common.Test/Steeltoe.Common.Test.csproj index 11c155dabe..d3c69d6a24 100644 --- a/src/Common/test/Common.Test/Steeltoe.Common.Test.csproj +++ b/src/Common/test/Common.Test/Steeltoe.Common.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Common/test/Hosting.Test/Steeltoe.Common.Hosting.Test.csproj b/src/Common/test/Hosting.Test/Steeltoe.Common.Hosting.Test.csproj index c64bb90b71..e9ba40b253 100644 --- a/src/Common/test/Hosting.Test/Steeltoe.Common.Hosting.Test.csproj +++ b/src/Common/test/Hosting.Test/Steeltoe.Common.Hosting.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Common/test/Http.Test/Steeltoe.Common.Http.Test.csproj b/src/Common/test/Http.Test/Steeltoe.Common.Http.Test.csproj index b119974f75..cb8374bbb0 100644 --- a/src/Common/test/Http.Test/Steeltoe.Common.Http.Test.csproj +++ b/src/Common/test/Http.Test/Steeltoe.Common.Http.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Common/test/Logging.Test/Steeltoe.Common.Logging.Test.csproj b/src/Common/test/Logging.Test/Steeltoe.Common.Logging.Test.csproj index d6a1a9d34e..4916e75364 100644 --- a/src/Common/test/Logging.Test/Steeltoe.Common.Logging.Test.csproj +++ b/src/Common/test/Logging.Test/Steeltoe.Common.Logging.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Common/test/Net.Test/Steeltoe.Common.Net.Test.csproj b/src/Common/test/Net.Test/Steeltoe.Common.Net.Test.csproj index 1b0953f58f..29f9280828 100644 --- a/src/Common/test/Net.Test/Steeltoe.Common.Net.Test.csproj +++ b/src/Common/test/Net.Test/Steeltoe.Common.Net.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Common/test/TestResources/CapturingLoggerProvider.cs b/src/Common/test/TestResources/CapturingLoggerProvider.cs index 5fa4262460..7dacd924ff 100644 --- a/src/Common/test/TestResources/CapturingLoggerProvider.cs +++ b/src/Common/test/TestResources/CapturingLoggerProvider.cs @@ -15,11 +15,7 @@ public sealed class CapturingLoggerProvider : ILoggerProvider private static readonly Func DefaultFilter = (_, _) => true; private readonly Func _filter; -#if NET9_0_OR_GREATER private readonly Lock _lockObject = new(); -#else - private readonly object _lockObject = new(); -#endif private readonly List _messages = []; diff --git a/src/Common/test/TestResources/DelegateToMockHttpClientHandler.cs b/src/Common/test/TestResources/DelegateToMockHttpClientHandler.cs index 2f94491b68..25307af9c0 100644 --- a/src/Common/test/TestResources/DelegateToMockHttpClientHandler.cs +++ b/src/Common/test/TestResources/DelegateToMockHttpClientHandler.cs @@ -15,7 +15,12 @@ public sealed class DelegateToMockHttpClientHandler : HttpClientHandler { // We want to forward to another HttpClient, but that fails because the outer client has already marked the message as sent. // To avoid the error "The request message was already sent...", we need to revert that mark. +#if NET11_0_OR_GREATER + private static readonly FieldInfo FlagsField = typeof(HttpRequestMessage).GetField("_flags", BindingFlags.NonPublic | BindingFlags.Instance)!; + private const int AlreadySentBit = 0x01; +#else private static readonly FieldInfo SendStatusField = typeof(HttpRequestMessage).GetField("_sendStatus", BindingFlags.NonPublic | BindingFlags.Instance)!; +#endif public MockHttpMessageHandler Mock { get; } = new(); @@ -49,6 +54,12 @@ protected override HttpResponseMessage Send(HttpRequestMessage request, Cancella private static void MarkMessageAsNotYetSent(HttpRequestMessage request) { +#if NET11_0_OR_GREATER + int flags = (int)FlagsField.GetValue(request)!; + flags &= ~AlreadySentBit; + FlagsField.SetValue(request, flags); +#else SendStatusField.SetValue(request, 0); +#endif } } diff --git a/src/Common/test/TestResources/MemoryFileProvider.cs b/src/Common/test/TestResources/MemoryFileProvider.cs index e28f45a91d..36df5fb1e8 100644 --- a/src/Common/test/TestResources/MemoryFileProvider.cs +++ b/src/Common/test/TestResources/MemoryFileProvider.cs @@ -172,7 +172,10 @@ private sealed class MemoryFileSystemEntry : IDirectoryContents, IFileInfo public long Length => _fileContents?.Length ?? -1; public DateTimeOffset LastModified => default; +#pragma warning disable IDE0028 // Simplify collection initialization + // Justification: ReSharper doesn't yet support the new 'with' syntax in collection initializers. public Dictionary Children { get; } = new(StringComparer.OrdinalIgnoreCase); +#pragma warning restore IDE0028 // Simplify collection initialization private MemoryFileSystemEntry(string name, byte[]? fileContents) { diff --git a/src/Common/test/TestResources/Steeltoe.Common.TestResources.csproj b/src/Common/test/TestResources/Steeltoe.Common.TestResources.csproj index 57c64767c0..cca25db27d 100644 --- a/src/Common/test/TestResources/Steeltoe.Common.TestResources.csproj +++ b/src/Common/test/TestResources/Steeltoe.Common.TestResources.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 false @@ -11,7 +11,6 @@ - diff --git a/src/Common/test/TestResources/TestContextExtensions.cs b/src/Common/test/TestResources/TestContextExtensions.cs index 5aefeaa5b1..7c6852a7bc 100644 --- a/src/Common/test/TestResources/TestContextExtensions.cs +++ b/src/Common/test/TestResources/TestContextExtensions.cs @@ -12,6 +12,7 @@ public static bool IsRunningOnBuildServer(this ITestContext testContext) { ArgumentNullException.ThrowIfNull(testContext); + _ = testContext; return Environment.GetEnvironmentVariable("CI") == "true"; } } diff --git a/src/Configuration/src/Abstractions/Steeltoe.Configuration.Abstractions.csproj b/src/Configuration/src/Abstractions/Steeltoe.Configuration.Abstractions.csproj index 9efd29ee97..ba1a5cbb7f 100644 --- a/src/Configuration/src/Abstractions/Steeltoe.Configuration.Abstractions.csproj +++ b/src/Configuration/src/Abstractions/Steeltoe.Configuration.Abstractions.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Steeltoe.Configuration Abstractions and code shared by Steeltoe Configuration libraries. abstractions;configuration diff --git a/src/Configuration/src/CloudFoundry/CloudFoundryConfigurationBuilderExtensions.cs b/src/Configuration/src/CloudFoundry/CloudFoundryConfigurationBuilderExtensions.cs index 30c9f0a28d..89cc4d9630 100644 --- a/src/Configuration/src/CloudFoundry/CloudFoundryConfigurationBuilderExtensions.cs +++ b/src/Configuration/src/CloudFoundry/CloudFoundryConfigurationBuilderExtensions.cs @@ -62,6 +62,8 @@ public static IConfigurationBuilder AddCloudFoundry(this IConfigurationBuilder b ArgumentNullException.ThrowIfNull(builder); ArgumentNullException.ThrowIfNull(loggerFactory); + _ = loggerFactory; + if (!builder.EnumerateSources().Any()) { var source = new CloudFoundryConfigurationSource(settingsReader); diff --git a/src/Configuration/src/CloudFoundry/CloudFoundryServiceCollectionExtensions.cs b/src/Configuration/src/CloudFoundry/CloudFoundryServiceCollectionExtensions.cs index a53699ed6f..f94799f49c 100644 --- a/src/Configuration/src/CloudFoundry/CloudFoundryServiceCollectionExtensions.cs +++ b/src/Configuration/src/CloudFoundry/CloudFoundryServiceCollectionExtensions.cs @@ -47,6 +47,6 @@ public static IServiceCollection AddCloudFoundryOptions(this IServiceCollection private static bool IsRegistered(IServiceCollection services) { - return services.Any(descriptor => descriptor.SafeGetImplementationType() == typeof(ConfigureCloudFoundryApplicationOptions)); + return services.Any(descriptor => descriptor.ImplementationType == typeof(ConfigureCloudFoundryApplicationOptions)); } } diff --git a/src/Configuration/src/CloudFoundry/Steeltoe.Configuration.CloudFoundry.csproj b/src/Configuration/src/CloudFoundry/Steeltoe.Configuration.CloudFoundry.csproj index 80c40aa143..5475b6f75f 100644 --- a/src/Configuration/src/CloudFoundry/Steeltoe.Configuration.CloudFoundry.csproj +++ b/src/Configuration/src/CloudFoundry/Steeltoe.Configuration.CloudFoundry.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Configuration provider and IOptions support for reading Cloud Foundry environment variables. configuration;ConfigurationProvider;CloudFoundry;vcap;vcap_application;vcap_services;tanzu true diff --git a/src/Configuration/src/ConfigServer/ConfigServerConfigurationProvider.cs b/src/Configuration/src/ConfigServer/ConfigServerConfigurationProvider.cs index 57cc7e4b2a..20b98da190 100644 --- a/src/Configuration/src/ConfigServer/ConfigServerConfigurationProvider.cs +++ b/src/Configuration/src/ConfigServer/ConfigServerConfigurationProvider.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.Net; using System.Net.Http.Headers; -using System.Net.Http.Json; using System.Net.Sockets; using System.Runtime.ExceptionServices; using System.Text; @@ -21,13 +20,6 @@ using Steeltoe.Common.Extensions; using Steeltoe.Common.Http; using Steeltoe.Common.Http.HttpClientPooling; -using LockPrimitive = -#if NET10_0_OR_GREATER - System.Threading.Lock -#else - object -#endif - ; namespace Steeltoe.Configuration.ConfigServer; @@ -47,9 +39,9 @@ internal sealed partial class ConfigServerConfigurationProvider : ConfigurationP private readonly bool _disposeHttpClientHandler; private readonly ConfigureConfigServerClientOptions _configurer; private readonly ConfigServerClientOptions _defaultOptions; - private readonly LockPrimitive _lifecycleLock = new(); - private readonly LockPrimitive _configurationReloadTickLock = new(); - private readonly LockPrimitive _vaultRenewTickLock = new(); + private readonly Lock _lifecycleLock = new(); + private readonly Lock _configurationReloadTickLock = new(); + private readonly Lock _vaultRenewTickLock = new(); private readonly ConfigServerDiscoveryService _configServerDiscoveryService; private readonly IDisposable _changeTokenRegistration; private readonly CancellationTokenSource _shutdownTokenSource = new(); @@ -197,11 +189,7 @@ private void ConfigurationReloadTimerTick() { LogEnteringConfigurationReloadCycle(); -#if NET10_0_OR_GREATER bool lockTaken = _configurationReloadTickLock.TryEnter(); -#else - bool lockTaken = Monitor.TryEnter(_configurationReloadTickLock); -#endif try { @@ -233,11 +221,7 @@ private void ConfigurationReloadTimerTick() { if (lockTaken) { -#if NET10_0_OR_GREATER _configurationReloadTickLock.Exit(); -#else - Monitor.Exit(_configurationReloadTickLock); -#endif } } } @@ -249,11 +233,7 @@ private void VaultRenewTimerTick() { LogEnteringVaultRenewCycle(); -#if NET10_0_OR_GREATER bool lockTaken = _vaultRenewTickLock.TryEnter(); -#else - bool lockTaken = Monitor.TryEnter(_vaultRenewTickLock); -#endif try { @@ -283,11 +263,7 @@ private void VaultRenewTimerTick() { if (lockTaken) { -#if NET10_0_OR_GREATER _vaultRenewTickLock.Exit(); -#else - Monitor.Exit(_vaultRenewTickLock); -#endif } } } diff --git a/src/Configuration/src/ConfigServer/ConfigServerDiscoveryService.cs b/src/Configuration/src/ConfigServer/ConfigServerDiscoveryService.cs index 6d7e3954c4..6e7296535b 100644 --- a/src/Configuration/src/ConfigServer/ConfigServerDiscoveryService.cs +++ b/src/Configuration/src/ConfigServer/ConfigServerDiscoveryService.cs @@ -12,13 +12,6 @@ using Steeltoe.Discovery.Configuration; using Steeltoe.Discovery.Consul; using Steeltoe.Discovery.Eureka; -using LockPrimitive = -#if NET10_0_OR_GREATER - System.Threading.Lock -#else - object -#endif - ; namespace Steeltoe.Configuration.ConfigServer; @@ -28,7 +21,7 @@ internal sealed partial class ConfigServerDiscoveryService private readonly IConfiguration _configuration; private readonly ILoggerFactory _loggerFactory; private readonly ILogger _logger; - private readonly LockPrimitive _initLock = new(); + private readonly Lock _initLock = new(); private ServiceProvider? _temporaryServiceProviderForDiscoveryClients; private volatile ICollection? _discoveryClients; diff --git a/src/Configuration/src/ConfigServer/Steeltoe.Configuration.ConfigServer.csproj b/src/Configuration/src/ConfigServer/Steeltoe.Configuration.ConfigServer.csproj index a4297db81d..8ebf38eddb 100644 --- a/src/Configuration/src/ConfigServer/Steeltoe.Configuration.ConfigServer.csproj +++ b/src/Configuration/src/ConfigServer/Steeltoe.Configuration.ConfigServer.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Configuration provider for Spring Cloud Config Server. configuration;ConfigurationProvider;spring-cloud;Spring;Cloud;Config;Server;Spring-Cloud-Config-Server;tanzu true @@ -8,6 +8,10 @@ + + + + diff --git a/src/Configuration/src/Encryption/Steeltoe.Configuration.Encryption.csproj b/src/Configuration/src/Encryption/Steeltoe.Configuration.Encryption.csproj index 99ea4150a5..2361a8737e 100644 --- a/src/Configuration/src/Encryption/Steeltoe.Configuration.Encryption.csproj +++ b/src/Configuration/src/Encryption/Steeltoe.Configuration.Encryption.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Configuration provider for decrypting encrypted configuration values. configuration;ConfigurationProvider;cryptography;decryption;Spring;Boot true diff --git a/src/Configuration/src/Kubernetes.ServiceBindings/ConfigurationBuilderExtensions.cs b/src/Configuration/src/Kubernetes.ServiceBindings/ConfigurationBuilderExtensions.cs index 3b0ffa3cd8..c99870971d 100644 --- a/src/Configuration/src/Kubernetes.ServiceBindings/ConfigurationBuilderExtensions.cs +++ b/src/Configuration/src/Kubernetes.ServiceBindings/ConfigurationBuilderExtensions.cs @@ -87,6 +87,8 @@ public static IConfigurationBuilder AddKubernetesServiceBindings(this IConfigura ArgumentNullException.ThrowIfNull(serviceBindingsReader); ArgumentNullException.ThrowIfNull(loggerFactory); + _ = loggerFactory; + if (!builder.EnumerateSources().Any()) { var source = new KubernetesServiceBindingConfigurationSource(serviceBindingsReader) diff --git a/src/Configuration/src/Kubernetes.ServiceBindings/Steeltoe.Configuration.Kubernetes.ServiceBindings.csproj b/src/Configuration/src/Kubernetes.ServiceBindings/Steeltoe.Configuration.Kubernetes.ServiceBindings.csproj index 7439614f6f..8977e092cc 100644 --- a/src/Configuration/src/Kubernetes.ServiceBindings/Steeltoe.Configuration.Kubernetes.ServiceBindings.csproj +++ b/src/Configuration/src/Kubernetes.ServiceBindings/Steeltoe.Configuration.Kubernetes.ServiceBindings.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Configuration provider for reading from Service Binding Specification for Kubernetes. configuration;ConfigurationProvider;kubernetes;k8s;bindings;service-bindings;cloud-native-bindings;cnb;tanzu true diff --git a/src/Configuration/src/Placeholder/Steeltoe.Configuration.Placeholder.csproj b/src/Configuration/src/Placeholder/Steeltoe.Configuration.Placeholder.csproj index 3d5ee8bfee..20a67ac575 100644 --- a/src/Configuration/src/Placeholder/Steeltoe.Configuration.Placeholder.csproj +++ b/src/Configuration/src/Placeholder/Steeltoe.Configuration.Placeholder.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Configuration provider for resolving property placeholders in configuration values. configuration;ConfigurationProvider;placeholders;Spring;Boot true diff --git a/src/Configuration/src/RandomValue/Steeltoe.Configuration.RandomValue.csproj b/src/Configuration/src/RandomValue/Steeltoe.Configuration.RandomValue.csproj index 1873d57c88..2b821a7b30 100644 --- a/src/Configuration/src/RandomValue/Steeltoe.Configuration.RandomValue.csproj +++ b/src/Configuration/src/RandomValue/Steeltoe.Configuration.RandomValue.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Configuration provider for generating random values. configuration;ConfigurationProvider;random true diff --git a/src/Configuration/src/SpringBoot/SpringBootConfigurationBuilderExtensions.cs b/src/Configuration/src/SpringBoot/SpringBootConfigurationBuilderExtensions.cs index 838158068f..49ab54589b 100644 --- a/src/Configuration/src/SpringBoot/SpringBootConfigurationBuilderExtensions.cs +++ b/src/Configuration/src/SpringBoot/SpringBootConfigurationBuilderExtensions.cs @@ -43,6 +43,8 @@ public static IConfigurationBuilder AddSpringBootFromEnvironmentVariable(this IC ArgumentNullException.ThrowIfNull(builder); ArgumentNullException.ThrowIfNull(loggerFactory); + _ = loggerFactory; + if (!builder.EnumerateSources().Any()) { builder.Add(new SpringBootEnvironmentVariableSource()); @@ -99,6 +101,8 @@ public static IConfigurationBuilder AddSpringBootFromCommandLine(this IConfigura ArgumentNullException.ThrowIfNull(args); ArgumentNullException.ThrowIfNull(loggerFactory); + _ = loggerFactory; + if (!builder.EnumerateSources().Any()) { builder.Add(new SpringBootCommandLineSource(args)); diff --git a/src/Configuration/src/SpringBoot/Steeltoe.Configuration.SpringBoot.csproj b/src/Configuration/src/SpringBoot/Steeltoe.Configuration.SpringBoot.csproj index 5606d85532..5e7c8e3979 100644 --- a/src/Configuration/src/SpringBoot/Steeltoe.Configuration.SpringBoot.csproj +++ b/src/Configuration/src/SpringBoot/Steeltoe.Configuration.SpringBoot.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Configuration provider for reading Spring Boot-style configuration. configuration;ConfigurationProvider;Spring;Boot true diff --git a/src/Configuration/test/CloudFoundry.Test/CloudfoundryConfigurationProviderTest.cs b/src/Configuration/test/CloudFoundry.Test/CloudfoundryConfigurationProviderTest.cs index d461d659a7..e5f346019d 100644 --- a/src/Configuration/test/CloudFoundry.Test/CloudfoundryConfigurationProviderTest.cs +++ b/src/Configuration/test/CloudFoundry.Test/CloudfoundryConfigurationProviderTest.cs @@ -12,13 +12,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Steeltoe.Common.TestResources; -using IPNetworkAlias = -#if NET10_0_OR_GREATER - System.Net.IPNetwork -#else - Microsoft.AspNetCore.HttpOverrides.IPNetwork -#endif - ; +using IPNetworkAlias = System.Net.IPNetwork; namespace Steeltoe.Configuration.CloudFoundry.Test; @@ -250,22 +244,14 @@ public async Task ForwardedHeadersOptions_unrestricted_when_running_on_CloudFoun { options.ForwardedHeaders.Should().HaveFlag(ForwardedHeaders.XForwardedFor); options.ForwardedHeaders.Should().HaveFlag(ForwardedHeaders.XForwardedProto); -#if NET10_0_OR_GREATER options.KnownIPNetworks.Should().BeEmpty(); -#else - options.KnownNetworks.Should().BeEmpty(); -#endif options.KnownProxies.Should().BeEmpty(); } else { options.ForwardedHeaders.Should().NotHaveFlag(ForwardedHeaders.XForwardedFor); options.ForwardedHeaders.Should().NotHaveFlag(ForwardedHeaders.XForwardedProto); -#if NET10_0_OR_GREATER options.KnownIPNetworks.Should().ContainSingle().Which.Should().BeEquivalentTo(IPNetworkAlias.Parse("127.0.0.1/8")); -#else - options.KnownNetworks.Should().ContainSingle().Which.Should().BeEquivalentTo(IPNetworkAlias.Parse("127.0.0.1/8")); -#endif options.KnownProxies.Should().ContainSingle().Which.Should().Be(IPAddress.Parse("::1")); } } diff --git a/src/Configuration/test/CloudFoundry.Test/Steeltoe.Configuration.CloudFoundry.Test.csproj b/src/Configuration/test/CloudFoundry.Test/Steeltoe.Configuration.CloudFoundry.Test.csproj index 095019fc55..f0fba594e1 100644 --- a/src/Configuration/test/CloudFoundry.Test/Steeltoe.Configuration.CloudFoundry.Test.csproj +++ b/src/Configuration/test/CloudFoundry.Test/Steeltoe.Configuration.CloudFoundry.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/ConfigServer.Discovery.Test/Steeltoe.Configuration.ConfigServer.Discovery.Test.csproj b/src/Configuration/test/ConfigServer.Discovery.Test/Steeltoe.Configuration.ConfigServer.Discovery.Test.csproj index 3d62140336..69e80feb07 100644 --- a/src/Configuration/test/ConfigServer.Discovery.Test/Steeltoe.Configuration.ConfigServer.Discovery.Test.csproj +++ b/src/Configuration/test/ConfigServer.Discovery.Test/Steeltoe.Configuration.ConfigServer.Discovery.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/ConfigServer.Integration.Test/Steeltoe.Configuration.ConfigServer.Integration.Test.csproj b/src/Configuration/test/ConfigServer.Integration.Test/Steeltoe.Configuration.ConfigServer.Integration.Test.csproj index 017de0c119..f31932323d 100644 --- a/src/Configuration/test/ConfigServer.Integration.Test/Steeltoe.Configuration.ConfigServer.Integration.Test.csproj +++ b/src/Configuration/test/ConfigServer.Integration.Test/Steeltoe.Configuration.ConfigServer.Integration.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/ConfigServer.Test/ConfigServerConfigurationProviderTest.cs b/src/Configuration/test/ConfigServer.Test/ConfigServerConfigurationProviderTest.cs index 7b8c950a39..d0fbf14884 100644 --- a/src/Configuration/test/ConfigServer.Test/ConfigServerConfigurationProviderTest.cs +++ b/src/Configuration/test/ConfigServer.Test/ConfigServerConfigurationProviderTest.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Net; -using System.Net.Http.Json; using System.Text; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging.Abstractions; diff --git a/src/Configuration/test/ConfigServer.Test/Steeltoe.Configuration.ConfigServer.Test.csproj b/src/Configuration/test/ConfigServer.Test/Steeltoe.Configuration.ConfigServer.Test.csproj index be6dd615fb..b88077a690 100644 --- a/src/Configuration/test/ConfigServer.Test/Steeltoe.Configuration.ConfigServer.Test.csproj +++ b/src/Configuration/test/ConfigServer.Test/Steeltoe.Configuration.ConfigServer.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/Encryption.Test/Steeltoe.Configuration.Encryption.Test.csproj b/src/Configuration/test/Encryption.Test/Steeltoe.Configuration.Encryption.Test.csproj index 93d3d367de..b569b0ca11 100644 --- a/src/Configuration/test/Encryption.Test/Steeltoe.Configuration.Encryption.Test.csproj +++ b/src/Configuration/test/Encryption.Test/Steeltoe.Configuration.Encryption.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/Kubernetes.ServiceBindings.Test/Steeltoe.Configuration.Kubernetes.ServiceBindings.Test.csproj b/src/Configuration/test/Kubernetes.ServiceBindings.Test/Steeltoe.Configuration.Kubernetes.ServiceBindings.Test.csproj index ff3cd2f418..9be398aa80 100644 --- a/src/Configuration/test/Kubernetes.ServiceBindings.Test/Steeltoe.Configuration.Kubernetes.ServiceBindings.Test.csproj +++ b/src/Configuration/test/Kubernetes.ServiceBindings.Test/Steeltoe.Configuration.Kubernetes.ServiceBindings.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/Placeholder.Test/Steeltoe.Configuration.Placeholder.Test.csproj b/src/Configuration/test/Placeholder.Test/Steeltoe.Configuration.Placeholder.Test.csproj index 9226d06016..deec8d0673 100644 --- a/src/Configuration/test/Placeholder.Test/Steeltoe.Configuration.Placeholder.Test.csproj +++ b/src/Configuration/test/Placeholder.Test/Steeltoe.Configuration.Placeholder.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/RandomValue.Test/Steeltoe.Configuration.RandomValue.Test.csproj b/src/Configuration/test/RandomValue.Test/Steeltoe.Configuration.RandomValue.Test.csproj index 102dbdb165..d362cb1a92 100644 --- a/src/Configuration/test/RandomValue.Test/Steeltoe.Configuration.RandomValue.Test.csproj +++ b/src/Configuration/test/RandomValue.Test/Steeltoe.Configuration.RandomValue.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Configuration/test/SpringBoot.Test/Steeltoe.Configuration.SpringBoot.Test.csproj b/src/Configuration/test/SpringBoot.Test/Steeltoe.Configuration.SpringBoot.Test.csproj index 0961801249..ee39a40e7d 100644 --- a/src/Configuration/test/SpringBoot.Test/Steeltoe.Configuration.SpringBoot.Test.csproj +++ b/src/Configuration/test/SpringBoot.Test/Steeltoe.Configuration.SpringBoot.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Connectors/src/Connectors/Connector.cs b/src/Connectors/src/Connectors/Connector.cs index 5d885e8883..de823391a1 100644 --- a/src/Connectors/src/Connectors/Connector.cs +++ b/src/Connectors/src/Connectors/Connector.cs @@ -4,13 +4,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using LockPrimitive = -#if NET10_0_OR_GREATER - System.Threading.Lock -#else - object -#endif - ; namespace Steeltoe.Connectors; @@ -32,7 +25,7 @@ public sealed class Connector : IDisposable private readonly bool _useSingletonConnection; private readonly IOptionsMonitor _optionsMonitor; - private readonly LockPrimitive _singletonLock = new(); + private readonly Lock _singletonLock = new(); private ConnectionWithOptionsSnapshot? _singletonSnapshot; private bool _singletonIsDisposed; diff --git a/src/Connectors/src/Connectors/Steeltoe.Connectors.csproj b/src/Connectors/src/Connectors/Steeltoe.Connectors.csproj index 5401c5d45a..96db9cea8f 100644 --- a/src/Connectors/src/Connectors/Steeltoe.Connectors.csproj +++ b/src/Connectors/src/Connectors/Steeltoe.Connectors.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Connectors for using service bindings in your application. connectors;service-bindings;vcap_services;cnb;tanzu true diff --git a/src/Connectors/src/EntityFrameworkCore/Steeltoe.Connectors.EntityFrameworkCore.csproj b/src/Connectors/src/EntityFrameworkCore/Steeltoe.Connectors.EntityFrameworkCore.csproj index ccd06f1162..e6c83b9559 100644 --- a/src/Connectors/src/EntityFrameworkCore/Steeltoe.Connectors.EntityFrameworkCore.csproj +++ b/src/Connectors/src/EntityFrameworkCore/Steeltoe.Connectors.EntityFrameworkCore.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Extensions for using Steeltoe Connectors with Entity Framework Core. connectors;EFCore;EntityFrameworkCore;EF;Entity;Framework;Core;entity-framework-core;services;tanzu true diff --git a/src/Connectors/test/Connectors.Test/PostgreSql/PostgreSqlConnectorTest.cs b/src/Connectors/test/Connectors.Test/PostgreSql/PostgreSqlConnectorTest.cs index fca421abc7..6522116cca 100644 --- a/src/Connectors/test/Connectors.Test/PostgreSql/PostgreSqlConnectorTest.cs +++ b/src/Connectors/test/Connectors.Test/PostgreSql/PostgreSqlConnectorTest.cs @@ -176,12 +176,15 @@ public sealed class PostgreSqlConnectorTest } """; +#pragma warning disable IDE0028 // Simplify collection initialization + // Justification: ReSharper doesn't yet support the new 'with' syntax in collection initializers. private static readonly HashSet TempFileKeys = new(StringComparer.OrdinalIgnoreCase) { "SSL Certificate", "SSL Key", "Root Certificate" }; +#pragma warning restore IDE0028 // Simplify collection initialization [Fact] public async Task Binds_options_without_service_bindings() diff --git a/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj b/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj index 7d6d266ce1..6b6407a2f3 100644 --- a/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj +++ b/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj @@ -1,6 +1,6 @@  - net10.0;net9.0;net8.0 + net11.0;net10.0 @@ -13,10 +13,9 @@ - + - diff --git a/src/Connectors/test/EntityFrameworkCore.Test/MigrateDbContextTaskTest.cs b/src/Connectors/test/EntityFrameworkCore.Test/MigrateDbContextTaskTest.cs index 7875cc6478..3a012d6635 100644 --- a/src/Connectors/test/EntityFrameworkCore.Test/MigrateDbContextTaskTest.cs +++ b/src/Connectors/test/EntityFrameworkCore.Test/MigrateDbContextTaskTest.cs @@ -61,11 +61,9 @@ public string GenerateScript(string? fromMigration = null, string? toMigration = throw new NotImplementedException(); } -#if NET9_0_OR_GREATER public bool HasPendingModelChanges() { throw new NotImplementedException(); } -#endif } } diff --git a/src/Connectors/test/EntityFrameworkCore.Test/MySql/Microting/MySqlDbContextOptionsBuilderExtensionsTest.other.cs b/src/Connectors/test/EntityFrameworkCore.Test/MySql/Microting/MySqlDbContextOptionsBuilderExtensionsTest.cs similarity index 94% rename from src/Connectors/test/EntityFrameworkCore.Test/MySql/Microting/MySqlDbContextOptionsBuilderExtensionsTest.other.cs rename to src/Connectors/test/EntityFrameworkCore.Test/MySql/Microting/MySqlDbContextOptionsBuilderExtensionsTest.cs index 88c6a5bd89..6fbe698889 100644 --- a/src/Connectors/test/EntityFrameworkCore.Test/MySql/Microting/MySqlDbContextOptionsBuilderExtensionsTest.other.cs +++ b/src/Connectors/test/EntityFrameworkCore.Test/MySql/Microting/MySqlDbContextOptionsBuilderExtensionsTest.cs @@ -16,7 +16,11 @@ namespace Steeltoe.Connectors.EntityFrameworkCore.Test.MySql.Microting; public sealed class MySqlDbContextOptionsBuilderExtensionsTest { +#if NET11_0_OR_GREATER + [Fact(Skip = "No version of Microting.EntityFrameworkCore.MySql exists yet that works with EF Core 11.")] +#else [Fact] +#endif public async Task Registers_connection_string_for_default_service_binding() { var appSettings = new Dictionary @@ -42,7 +46,11 @@ public async Task Registers_connection_string_for_default_service_binding() "Server=localhost;User ID=steeltoe;Password=steeltoe;Database=myDb;Allow User Variables=True;Connection Timeout=15;Use Affected Rows=False;Use Compression=False"); } +#if NET11_0_OR_GREATER + [Fact(Skip = "No version of Microting.EntityFrameworkCore.MySql exists yet that works with EF Core 11.")] +#else [Fact] +#endif public async Task Registers_connection_string_for_named_service_binding() { var appSettings = new Dictionary diff --git a/src/Connectors/test/EntityFrameworkCore.Test/MySql/Oracle/MySqlDbContextOptionsBuilderExtensionsTest.cs b/src/Connectors/test/EntityFrameworkCore.Test/MySql/Oracle/MySqlDbContextOptionsBuilderExtensionsTest.cs index 735addf178..f76a84690d 100644 --- a/src/Connectors/test/EntityFrameworkCore.Test/MySql/Oracle/MySqlDbContextOptionsBuilderExtensionsTest.cs +++ b/src/Connectors/test/EntityFrameworkCore.Test/MySql/Oracle/MySqlDbContextOptionsBuilderExtensionsTest.cs @@ -16,7 +16,11 @@ namespace Steeltoe.Connectors.EntityFrameworkCore.Test.MySql.Oracle; public sealed class MySqlDbContextOptionsBuilderExtensionsTest { +#if NET11_0_OR_GREATER + [Fact(Skip = "No version of MySql.EntityFrameworkCore exists yet that works with EF Core 11.")] +#else [Fact] +#endif public async Task Registers_connection_string_for_default_service_binding() { var appSettings = new Dictionary @@ -41,7 +45,11 @@ public async Task Registers_connection_string_for_default_service_binding() connectionString.Should().Be("server=localhost;database=myDb;user id=steeltoe;password=steeltoe;connectiontimeout=15;Use Compression=false"); } +#if NET11_0_OR_GREATER + [Fact(Skip = "No version of MySql.EntityFrameworkCore exists yet that works with EF Core 11.")] +#else [Fact] +#endif public async Task Registers_connection_string_for_named_service_binding() { var appSettings = new Dictionary @@ -65,4 +73,12 @@ public async Task Registers_connection_string_for_named_service_binding() connectionString.Should().Be("server=localhost;database=myDb;user id=steeltoe;password=steeltoe;connectiontimeout=15;Use Compression=false"); } + +#if NET11_0_OR_GREATER + [Fact] + public void Dummy_test_to_suppress_warning_that_all_tests_were_ignored() + { + true.Should().BeTrue(); + } +#endif } diff --git a/src/Connectors/test/EntityFrameworkCore.Test/MySql/Pomelo/MySqlDbContextOptionsBuilderExtensionsTest.net80-90.cs b/src/Connectors/test/EntityFrameworkCore.Test/MySql/Pomelo/MySqlDbContextOptionsBuilderExtensionsTest.net80-90.cs deleted file mode 100644 index fb7001e67a..0000000000 --- a/src/Connectors/test/EntityFrameworkCore.Test/MySql/Pomelo/MySqlDbContextOptionsBuilderExtensionsTest.net80-90.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using Microsoft.AspNetCore.Builder; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Steeltoe.Common.TestResources; -using Steeltoe.Connectors.EntityFrameworkCore.MySql.DynamicTypeAccess; -using Steeltoe.Connectors.MySql; -using Steeltoe.Connectors.MySql.DynamicTypeAccess; -using SteeltoeExtensions = Steeltoe.Connectors.EntityFrameworkCore.MySql.MySqlDbContextOptionsBuilderExtensions; - -namespace Steeltoe.Connectors.EntityFrameworkCore.Test.MySql.Pomelo; - -public sealed class MySqlDbContextOptionsBuilderExtensionsTest -{ - [Fact] - public async Task Registers_connection_string_for_default_service_binding() - { - var appSettings = new Dictionary - { - ["Steeltoe:Client:MySql:Default:ConnectionString"] = "SERVER=localhost;database=myDb;UID=steeltoe;PWD=steeltoe;connect timeout=15" - }; - - WebApplicationBuilder builder = TestWebApplicationBuilderFactory.Create(); - builder.Configuration.AddInMemoryCollection(appSettings); - builder.AddMySql(MySqlPackageResolver.MySqlConnectorOnly, null, null, null); - builder.Services.Configure(options => options.ConnectionString += ";Use Compression=false"); - - builder.Services.AddDbContext((serviceProvider, options) => SteeltoeExtensions.UseMySql(options, serviceProvider, - MySqlEntityFrameworkCorePackageResolver.PomeloOnly, serverVersion: MySqlServerVersion.LatestSupportedServerVersion)); - - await using WebApplication app = builder.Build(); - - await using AsyncServiceScope scope = app.Services.CreateAsyncScope(); - await using var dbContext = scope.ServiceProvider.GetRequiredService(); - string? connectionString = dbContext.Database.GetConnectionString(); - - connectionString.Should().Be( - "Server=localhost;User ID=steeltoe;Password=steeltoe;Database=myDb;Allow User Variables=True;Connection Timeout=15;Use Affected Rows=False;Use Compression=False"); - } - - [Fact] - public async Task Registers_connection_string_for_named_service_binding() - { - var appSettings = new Dictionary - { - ["Steeltoe:Client:MySql:myMySqlService:ConnectionString"] = "SERVER=localhost;database=myDb;UID=steeltoe;PWD=steeltoe;connect timeout=15" - }; - - WebApplicationBuilder builder = TestWebApplicationBuilderFactory.Create(); - builder.Configuration.AddInMemoryCollection(appSettings); - builder.AddMySql(MySqlPackageResolver.MySqlConnectorOnly, null, null, null); - builder.Services.Configure("myMySqlService", options => options.ConnectionString += ";Use Compression=false"); - - builder.Services.AddDbContext((serviceProvider, options) => SteeltoeExtensions.UseMySql(options, serviceProvider, - MySqlEntityFrameworkCorePackageResolver.PomeloOnly, "myMySqlService", MySqlServerVersion.LatestSupportedServerVersion)); - - await using WebApplication app = builder.Build(); - - await using AsyncServiceScope scope = app.Services.CreateAsyncScope(); - await using var dbContext = scope.ServiceProvider.GetRequiredService(); - string? connectionString = dbContext.Database.GetConnectionString(); - - connectionString.Should().Be( - "Server=localhost;User ID=steeltoe;Password=steeltoe;Database=myDb;Allow User Variables=True;Connection Timeout=15;Use Affected Rows=False;Use Compression=False"); - } - - [Fact] - public async Task Throws_for_missing_connection_string_with_version_detection() - { - WebApplicationBuilder builder = TestWebApplicationBuilderFactory.Create(); - builder.AddMySql(MySqlPackageResolver.MySqlConnectorOnly, null, null, null); - - builder.Services.AddDbContext((serviceProvider, options) => SteeltoeExtensions.UseMySql(options, serviceProvider, - MySqlEntityFrameworkCorePackageResolver.PomeloOnly)); - - await using WebApplication app = builder.Build(); - await using AsyncServiceScope scope = app.Services.CreateAsyncScope(); - - // ReSharper disable once AccessToDisposedClosure - Action action = () => _ = scope.ServiceProvider.GetRequiredService(); - - action.Should().ThrowExactly().WithMessage("Server version must be specified when no connection string is provided."); - } -} diff --git a/src/Connectors/test/EntityFrameworkCore.Test/Steeltoe.Connectors.EntityFrameworkCore.Test.csproj b/src/Connectors/test/EntityFrameworkCore.Test/Steeltoe.Connectors.EntityFrameworkCore.Test.csproj index 27f23bfef4..4f7acd365f 100644 --- a/src/Connectors/test/EntityFrameworkCore.Test/Steeltoe.Connectors.EntityFrameworkCore.Test.csproj +++ b/src/Connectors/test/EntityFrameworkCore.Test/Steeltoe.Connectors.EntityFrameworkCore.Test.csproj @@ -1,33 +1,21 @@ - net10.0;net9.0;net8.0 + net11.0;net10.0 - - - - - - - - + + + + + + - - - - - - - - - - diff --git a/src/Discovery/src/Configuration/ConfigurationServiceCollectionExtensions.cs b/src/Discovery/src/Configuration/ConfigurationServiceCollectionExtensions.cs index 4d5bd83405..cf4691e3e0 100644 --- a/src/Discovery/src/Configuration/ConfigurationServiceCollectionExtensions.cs +++ b/src/Discovery/src/Configuration/ConfigurationServiceCollectionExtensions.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Steeltoe.Common; using Steeltoe.Common.Discovery; namespace Steeltoe.Discovery.Configuration; @@ -63,6 +62,6 @@ public static IServiceCollection AddConfigurationDiscoveryClient(this IServiceCo private static bool IsRegistered(IServiceCollection services) { - return services.Any(descriptor => descriptor.SafeGetImplementationType() == typeof(ConfigurationDiscoveryClient)); + return services.Any(descriptor => descriptor.ImplementationType == typeof(ConfigurationDiscoveryClient)); } } diff --git a/src/Discovery/src/Configuration/Steeltoe.Discovery.Configuration.csproj b/src/Discovery/src/Configuration/Steeltoe.Discovery.Configuration.csproj index db968e9da4..5ab85c2e15 100644 --- a/src/Discovery/src/Configuration/Steeltoe.Discovery.Configuration.csproj +++ b/src/Discovery/src/Configuration/Steeltoe.Discovery.Configuration.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Client for service discovery from application configuration. service-discovery;service-registry;configuration-based true diff --git a/src/Discovery/src/Consul/ConsulServiceCollectionExtensions.cs b/src/Discovery/src/Consul/ConsulServiceCollectionExtensions.cs index 86eceb2c4b..4addd2fd6b 100644 --- a/src/Discovery/src/Consul/ConsulServiceCollectionExtensions.cs +++ b/src/Discovery/src/Consul/ConsulServiceCollectionExtensions.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; -using Steeltoe.Common; using Steeltoe.Common.Discovery; using Steeltoe.Common.Extensions; using Steeltoe.Common.HealthChecks; @@ -44,7 +43,7 @@ public static IServiceCollection AddConsulDiscoveryClient(this IServiceCollectio private static bool IsRegistered(IServiceCollection services) { - return services.Any(descriptor => descriptor.SafeGetImplementationType() == typeof(PostConfigureConsulDiscoveryOptions)); + return services.Any(descriptor => descriptor.ImplementationType == typeof(PostConfigureConsulDiscoveryOptions)); } private static void ConfigureConsulServices(IServiceCollection services) diff --git a/src/Discovery/src/Consul/Steeltoe.Discovery.Consul.csproj b/src/Discovery/src/Consul/Steeltoe.Discovery.Consul.csproj index 85ae4ecaff..fdbea2e336 100644 --- a/src/Discovery/src/Consul/Steeltoe.Discovery.Consul.csproj +++ b/src/Discovery/src/Consul/Steeltoe.Discovery.Consul.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Client for service discovery and registration with Hashicorp Consul. service-discovery;service-registry;Consul;hashicorp true diff --git a/src/Discovery/src/Eureka/EurekaApplicationInfoManager.cs b/src/Discovery/src/Eureka/EurekaApplicationInfoManager.cs index dfb1702476..760e392146 100644 --- a/src/Discovery/src/Eureka/EurekaApplicationInfoManager.cs +++ b/src/Discovery/src/Eureka/EurekaApplicationInfoManager.cs @@ -6,13 +6,6 @@ using Microsoft.Extensions.Options; using Steeltoe.Discovery.Eureka.AppInfo; using Steeltoe.Discovery.Eureka.Configuration; -using LockPrimitive = -#if NET10_0_OR_GREATER - System.Threading.Lock -#else - object -#endif - ; namespace Steeltoe.Discovery.Eureka; @@ -26,7 +19,7 @@ public sealed partial class EurekaApplicationInfoManager : IDisposable private readonly TimeProvider _timeProvider; private readonly IDisposable? _instanceOptionsChangeToken; private readonly ILogger _logger; - private readonly LockPrimitive _instanceWriteLock = new(); + private readonly Lock _instanceWriteLock = new(); // Readers must never be blocked, as it may delay the periodic heartbeat. // Updates from user code must be synchronized with configuration changes. diff --git a/src/Discovery/src/Eureka/EurekaClient.cs b/src/Discovery/src/Eureka/EurekaClient.cs index b70ea830aa..792ee07e17 100644 --- a/src/Discovery/src/Eureka/EurekaClient.cs +++ b/src/Discovery/src/Eureka/EurekaClient.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.Net; using System.Net.Http.Headers; -using System.Net.Http.Json; using System.Text; using System.Text.Json; using Microsoft.AspNetCore.Http.Extensions; diff --git a/src/Discovery/src/Eureka/EurekaServiceCollectionExtensions.cs b/src/Discovery/src/Eureka/EurekaServiceCollectionExtensions.cs index 845a5332b4..205eb8bfb3 100644 --- a/src/Discovery/src/Eureka/EurekaServiceCollectionExtensions.cs +++ b/src/Discovery/src/Eureka/EurekaServiceCollectionExtensions.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; -using Steeltoe.Common; using Steeltoe.Common.Certificates; using Steeltoe.Common.Discovery; using Steeltoe.Common.Extensions; @@ -46,7 +45,7 @@ public static IServiceCollection AddEurekaDiscoveryClient(this IServiceCollectio private static bool IsRegistered(IServiceCollection services) { - return services.Any(descriptor => descriptor.SafeGetImplementationType() == typeof(EurekaDiscoveryClient)); + return services.Any(descriptor => descriptor.ImplementationType == typeof(EurekaDiscoveryClient)); } private static void ConfigureEurekaServices(IServiceCollection services) diff --git a/src/Discovery/src/Eureka/EurekaServiceUriStateManager.cs b/src/Discovery/src/Eureka/EurekaServiceUriStateManager.cs index ad5f0c004c..5b79be31c8 100644 --- a/src/Discovery/src/Eureka/EurekaServiceUriStateManager.cs +++ b/src/Discovery/src/Eureka/EurekaServiceUriStateManager.cs @@ -6,13 +6,6 @@ using Microsoft.Extensions.Options; using Steeltoe.Discovery.Eureka.Configuration; using Steeltoe.Discovery.Eureka.Transport; -using LockPrimitive = -#if NET10_0_OR_GREATER - System.Threading.Lock -#else - object -#endif - ; namespace Steeltoe.Discovery.Eureka; @@ -24,7 +17,7 @@ public sealed partial class EurekaServiceUriStateManager private readonly IOptionsMonitor _optionsMonitor; private readonly ILogger _logger; - private readonly LockPrimitive _lockObject = new(); + private readonly Lock _lockObject = new(); private readonly HashSet _failedServiceUris = []; private Uri? _lastWorkingServiceUri; diff --git a/src/Discovery/src/Eureka/Steeltoe.Discovery.Eureka.csproj b/src/Discovery/src/Eureka/Steeltoe.Discovery.Eureka.csproj index 726a65c3a4..5e343557c9 100644 --- a/src/Discovery/src/Eureka/Steeltoe.Discovery.Eureka.csproj +++ b/src/Discovery/src/Eureka/Steeltoe.Discovery.Eureka.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Client for service discovery and registration with Netflix Eureka. service-discovery;service-registry;Netflix-Eureka;eureka;tanzu;spring-cloud;Spring;Cloud;Netflix true diff --git a/src/Discovery/src/HttpClients/Steeltoe.Discovery.HttpClients.csproj b/src/Discovery/src/HttpClients/Steeltoe.Discovery.HttpClients.csproj index 27d2549b4b..2485721071 100644 --- a/src/Discovery/src/HttpClients/Steeltoe.Discovery.HttpClients.csproj +++ b/src/Discovery/src/HttpClients/Steeltoe.Discovery.HttpClients.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Enables HTTP clients to load-balance over discovered service instances. service-discovery;service-registry;load-balancing;round-robin;httpclient;httpclientfactory true @@ -10,6 +10,7 @@ + diff --git a/src/Discovery/test/Configuration.Test/Steeltoe.Discovery.Configuration.Test.csproj b/src/Discovery/test/Configuration.Test/Steeltoe.Discovery.Configuration.Test.csproj index 7d56666bcb..1d58980862 100644 --- a/src/Discovery/test/Configuration.Test/Steeltoe.Discovery.Configuration.Test.csproj +++ b/src/Discovery/test/Configuration.Test/Steeltoe.Discovery.Configuration.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Discovery/test/Consul.Test/Steeltoe.Discovery.Consul.Test.csproj b/src/Discovery/test/Consul.Test/Steeltoe.Discovery.Consul.Test.csproj index 9d04c2d612..f9edbd20c9 100644 --- a/src/Discovery/test/Consul.Test/Steeltoe.Discovery.Consul.Test.csproj +++ b/src/Discovery/test/Consul.Test/Steeltoe.Discovery.Consul.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Discovery/test/Eureka.Test/Steeltoe.Discovery.Eureka.Test.csproj b/src/Discovery/test/Eureka.Test/Steeltoe.Discovery.Eureka.Test.csproj index 28d96ac0da..eee3edaf3f 100644 --- a/src/Discovery/test/Eureka.Test/Steeltoe.Discovery.Eureka.Test.csproj +++ b/src/Discovery/test/Eureka.Test/Steeltoe.Discovery.Eureka.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Discovery/test/HttpClients.Test/Steeltoe.Discovery.HttpClients.Test.csproj b/src/Discovery/test/HttpClients.Test/Steeltoe.Discovery.HttpClients.Test.csproj index e9458c6127..4cda6255e0 100644 --- a/src/Discovery/test/HttpClients.Test/Steeltoe.Discovery.HttpClients.Test.csproj +++ b/src/Discovery/test/HttpClients.Test/Steeltoe.Discovery.HttpClients.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 @@ -11,6 +11,10 @@ + + + + diff --git a/src/Logging/src/Abstractions/Steeltoe.Logging.Abstractions.csproj b/src/Logging/src/Abstractions/Steeltoe.Logging.Abstractions.csproj index df179a4e84..2d84b4b9a1 100644 --- a/src/Logging/src/Abstractions/Steeltoe.Logging.Abstractions.csproj +++ b/src/Logging/src/Abstractions/Steeltoe.Logging.Abstractions.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Steeltoe.Logging Abstractions for managing minimum logging levels at runtime. abstractions;logging;dynamic-logging;log-management diff --git a/src/Logging/src/DynamicConsole/LoggingBuilderExtensions.cs b/src/Logging/src/DynamicConsole/LoggingBuilderExtensions.cs index 9137293171..1778255b43 100644 --- a/src/Logging/src/DynamicConsole/LoggingBuilderExtensions.cs +++ b/src/Logging/src/DynamicConsole/LoggingBuilderExtensions.cs @@ -49,7 +49,7 @@ private static bool IsDynamicLoggerProviderAlreadyRegistered(ILoggingBuilder bui private static void EnsureConsoleLoggingIsRegistered(ILoggingBuilder builder) { - if (builder.Services.All(descriptor => descriptor.SafeGetImplementationType() != typeof(ConsoleLoggerProvider))) + if (builder.Services.All(descriptor => descriptor.ImplementationType != typeof(ConsoleLoggerProvider))) { builder.AddConsole(); } @@ -58,7 +58,7 @@ private static void EnsureConsoleLoggingIsRegistered(ILoggingBuilder builder) private static void UpdateConsoleLoggerProviderRegistration(IServiceCollection services) { // Remove the original ConsoleLoggerProvider registration as ILoggerProvider to prevent duplicate logging. - ServiceDescriptor? descriptor = services.FirstOrDefault(descriptor => descriptor.SafeGetImplementationType() == typeof(ConsoleLoggerProvider)); + ServiceDescriptor? descriptor = services.FirstOrDefault(descriptor => descriptor.ImplementationType == typeof(ConsoleLoggerProvider)); if (descriptor != null) { diff --git a/src/Logging/src/DynamicConsole/Steeltoe.Logging.DynamicConsole.csproj b/src/Logging/src/DynamicConsole/Steeltoe.Logging.DynamicConsole.csproj index fb04b352d7..1c995971bd 100644 --- a/src/Logging/src/DynamicConsole/Steeltoe.Logging.DynamicConsole.csproj +++ b/src/Logging/src/DynamicConsole/Steeltoe.Logging.DynamicConsole.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Manage minimum logging levels at runtime using ConsoleLogger. logging;dynamic-logging;console;log-management;monitoring true diff --git a/src/Logging/src/DynamicSerilog/DynamicSerilogLoggerProvider.cs b/src/Logging/src/DynamicSerilog/DynamicSerilogLoggerProvider.cs index 3751d64dbb..b9a2110f0d 100644 --- a/src/Logging/src/DynamicSerilog/DynamicSerilogLoggerProvider.cs +++ b/src/Logging/src/DynamicSerilog/DynamicSerilogLoggerProvider.cs @@ -7,13 +7,6 @@ using Serilog.Core; using Serilog.Events; using Serilog.Extensions.Logging; -using LockPrimitive = -#if NET10_0_OR_GREATER - System.Threading.Lock -#else - object -#endif - ; namespace Steeltoe.Logging.DynamicSerilog; @@ -22,7 +15,7 @@ namespace Steeltoe.Logging.DynamicSerilog; /// public sealed class DynamicSerilogLoggerProvider : DynamicLoggerProvider { - private static readonly LockPrimitive LoggerLock = new(); + private static readonly Lock LoggerLock = new(); private static Logger? _serilogLogger; private readonly IDisposable? _optionsChangeListener; diff --git a/src/Logging/src/DynamicSerilog/SerilogLoggingBuilderExtensions.cs b/src/Logging/src/DynamicSerilog/SerilogLoggingBuilderExtensions.cs index c01090d0ca..0caf12203c 100644 --- a/src/Logging/src/DynamicSerilog/SerilogLoggingBuilderExtensions.cs +++ b/src/Logging/src/DynamicSerilog/SerilogLoggingBuilderExtensions.cs @@ -8,7 +8,6 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Serilog; -using Steeltoe.Common; namespace Steeltoe.Logging.DynamicSerilog; @@ -104,7 +103,7 @@ public static ILoggingBuilder AddDynamicSerilog(this ILoggingBuilder builder, Lo private static bool IsSerilogDynamicLoggerProviderAlreadyRegistered(ILoggingBuilder builder) { return builder.Services.Any(descriptor => - descriptor.SafeGetImplementationType() == typeof(DynamicSerilogLoggerProvider) && descriptor.ServiceType == typeof(ILoggerProvider)); + descriptor.ImplementationType == typeof(DynamicSerilogLoggerProvider) && descriptor.ServiceType == typeof(ILoggerProvider)); } private static void AssertNoDynamicLoggerProviderRegistered(ILoggingBuilder builder) diff --git a/src/Logging/src/DynamicSerilog/Steeltoe.Logging.DynamicSerilog.csproj b/src/Logging/src/DynamicSerilog/Steeltoe.Logging.DynamicSerilog.csproj index f7cb4cd3d5..3c7106bc13 100644 --- a/src/Logging/src/DynamicSerilog/Steeltoe.Logging.DynamicSerilog.csproj +++ b/src/Logging/src/DynamicSerilog/Steeltoe.Logging.DynamicSerilog.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Manage minimum logging levels at runtime using Serilog. logging;dynamic-logging;serilog;log-management;monitoring true diff --git a/src/Logging/test/DynamicConsole.Test/DynamicConsoleLoggerProviderTest.cs b/src/Logging/test/DynamicConsole.Test/DynamicConsoleLoggerProviderTest.cs index dce86c3f4e..a20f28e142 100644 --- a/src/Logging/test/DynamicConsole.Test/DynamicConsoleLoggerProviderTest.cs +++ b/src/Logging/test/DynamicConsole.Test/DynamicConsoleLoggerProviderTest.cs @@ -457,7 +457,7 @@ public async Task CanUseJsonFormatterWithScopes() { ["Logging:Console:FormatterName"] = "json", ["Logging:Console:FormatterOptions:IncludeScopes"] = "true", - ["Logging:Console:FormatterOptions:TimestampFormat"] = string.Empty, + // Breaking change: https://github.com/dotnet/runtime/pull/131480 ["Logging:Console:FormatterOptions:JsonWriterOptions:Indented"] = "true" }; diff --git a/src/Logging/test/DynamicConsole.Test/Steeltoe.Logging.DynamicConsole.Test.csproj b/src/Logging/test/DynamicConsole.Test/Steeltoe.Logging.DynamicConsole.Test.csproj index ec171ac8c0..331f0aced8 100644 --- a/src/Logging/test/DynamicConsole.Test/Steeltoe.Logging.DynamicConsole.Test.csproj +++ b/src/Logging/test/DynamicConsole.Test/Steeltoe.Logging.DynamicConsole.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Logging/test/DynamicSerilog.Test/Steeltoe.Logging.DynamicSerilog.Test.csproj b/src/Logging/test/DynamicSerilog.Test/Steeltoe.Logging.DynamicSerilog.Test.csproj index 0620235176..79602b1381 100644 --- a/src/Logging/test/DynamicSerilog.Test/Steeltoe.Logging.DynamicSerilog.Test.csproj +++ b/src/Logging/test/DynamicSerilog.Test/Steeltoe.Logging.DynamicSerilog.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Management/src/Abstractions/Steeltoe.Management.Abstractions.csproj b/src/Management/src/Abstractions/Steeltoe.Management.Abstractions.csproj index 8f01a65466..8b844ff4fe 100644 --- a/src/Management/src/Abstractions/Steeltoe.Management.Abstractions.csproj +++ b/src/Management/src/Abstractions/Steeltoe.Management.Abstractions.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Steeltoe.Management Abstractions for application management and monitoring. abstractions;actuator diff --git a/src/Management/src/Endpoint/Actuators/RouteMappings/AspNetEndpointProvider.cs b/src/Management/src/Endpoint/Actuators/RouteMappings/AspNetEndpointProvider.cs index 018ac42330..2af44405f7 100644 --- a/src/Management/src/Endpoint/Actuators/RouteMappings/AspNetEndpointProvider.cs +++ b/src/Management/src/Endpoint/Actuators/RouteMappings/AspNetEndpointProvider.cs @@ -110,7 +110,7 @@ private static IEnumerable FlattenDataSources(IEnumerable GetDependencies(ServiceDescriptor descriptor) { - Type? implementationType = descriptor.SafeGetImplementationType(); + Type? implementationType = GetKeyedOrDefaultImplementationType(descriptor); if (implementationType == null) { @@ -77,6 +85,11 @@ private static ISet GetDependencies(ServiceDescriptor descriptor) return dependencies; } + private static Type? GetKeyedOrDefaultImplementationType(ServiceDescriptor descriptor) + { + return descriptor.IsKeyedService ? descriptor.KeyedImplementationType : descriptor.ImplementationType; + } + private static void IncludeParametersFrom(ConstructorInfo constructor, HashSet dependencies) { foreach (ParameterInfo parameter in constructor.GetParameters()) diff --git a/src/Management/src/Endpoint/ConfigurationSchema.json b/src/Management/src/Endpoint/ConfigurationSchema.json index 8f86663c53..60086ae57d 100644 --- a/src/Management/src/Endpoint/ConfigurationSchema.json +++ b/src/Management/src/Endpoint/ConfigurationSchema.json @@ -671,6 +671,9 @@ "type": "integer", "description": "Defines the indentation size being used when 'System.Text.Json.JsonSerializerOptions.WriteIndented' is enabled. Defaults to two." }, + "InferClosedTypePolymorphism": { + "type": "boolean" + }, "MaxDepth": { "type": "integer", "description": "Gets or sets the maximum depth allowed when serializing or deserializing JSON, with the default value of 0 indicating a maximum depth of 64." diff --git a/src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminApiClient.cs b/src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminApiClient.cs index 99ca446b9b..d3e1de0a1e 100644 --- a/src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminApiClient.cs +++ b/src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminApiClient.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System.Net.Http.Json; using Steeltoe.Common.Http; namespace Steeltoe.Management.Endpoint.SpringBootAdminClient; diff --git a/src/Management/src/Endpoint/Steeltoe.Management.Endpoint.csproj b/src/Management/src/Endpoint/Steeltoe.Management.Endpoint.csproj index 8432fa8518..409d0abbe2 100755 --- a/src/Management/src/Endpoint/Steeltoe.Management.Endpoint.csproj +++ b/src/Management/src/Endpoint/Steeltoe.Management.Endpoint.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Steeltoe management endpoints, also known as actuators. Includes support for Cloud Foundry integration. actuator;actuators;management;monitoring;Spring;Boot;dbmigrations;health;heap-dump;loggers;route-mappings;thread-dump;tanzu true @@ -22,6 +22,7 @@ + @@ -46,10 +47,10 @@ + <_DotNetGCDumpNet11 Include="$(MSBuildProjectDirectory)\bin\$(Configuration)\net11.0\dotnet-gcdump.dll" Pack="True" PackagePath="lib\net11.0" /> <_DotNetGCDumpNet10 Include="$(MSBuildProjectDirectory)\bin\$(Configuration)\net10.0\dotnet-gcdump.dll" Pack="True" PackagePath="lib\net10.0" /> - <_DotNetGCDumpNet8 Include="$(MSBuildProjectDirectory)\bin\$(Configuration)\net8.0\dotnet-gcdump.dll" Pack="True" PackagePath="lib\net8.0" /> + - diff --git a/src/Management/src/Prometheus/Steeltoe.Management.Prometheus.csproj b/src/Management/src/Prometheus/Steeltoe.Management.Prometheus.csproj index f37e894adf..aa4e168206 100644 --- a/src/Management/src/Prometheus/Steeltoe.Management.Prometheus.csproj +++ b/src/Management/src/Prometheus/Steeltoe.Management.Prometheus.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Adds Prometheus support for Steeltoe management endpoints. actuator;actuators;management;monitoring;metrics;prometheus;tanzu;appmetrics;aspnetcore true diff --git a/src/Management/src/Tasks/Steeltoe.Management.Tasks.csproj b/src/Management/src/Tasks/Steeltoe.Management.Tasks.csproj index 375ca05744..300355ee46 100644 --- a/src/Management/src/Tasks/Steeltoe.Management.Tasks.csproj +++ b/src/Management/src/Tasks/Steeltoe.Management.Tasks.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Extensions for running tasks embedded in your .NET application. Ideal for cf run-task in Cloud Foundry. tasks;management;Spring;Cloud;cf;run-task true diff --git a/src/Management/src/Tracing/Steeltoe.Management.Tracing.csproj b/src/Management/src/Tracing/Steeltoe.Management.Tracing.csproj index fc918c0843..9edfa28398 100644 --- a/src/Management/src/Tracing/Steeltoe.Management.Tracing.csproj +++ b/src/Management/src/Tracing/Steeltoe.Management.Tracing.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Adds trace information to logging output in distributed systems. management;monitoring;distributed;tracing true diff --git a/src/Management/test/Endpoint.Test/Actuators/CloudFoundry/PermissionsProviderTest.cs b/src/Management/test/Endpoint.Test/Actuators/CloudFoundry/PermissionsProviderTest.cs index 8b5c55ffe7..7557991448 100644 --- a/src/Management/test/Endpoint.Test/Actuators/CloudFoundry/PermissionsProviderTest.cs +++ b/src/Management/test/Endpoint.Test/Actuators/CloudFoundry/PermissionsProviderTest.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Net; -using System.Net.Http.Json; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging.Abstractions; diff --git a/src/Management/test/Endpoint.Test/Actuators/Health/HealthActuatorTest.cs b/src/Management/test/Endpoint.Test/Actuators/Health/HealthActuatorTest.cs index 4a5e408466..a7c5e8bdab 100644 --- a/src/Management/test/Endpoint.Test/Actuators/Health/HealthActuatorTest.cs +++ b/src/Management/test/Endpoint.Test/Actuators/Health/HealthActuatorTest.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Net; -using System.Net.Http.Json; using System.Security.Claims; using System.Text.Json.Nodes; using Microsoft.AspNetCore.Builder; diff --git a/src/Management/test/Endpoint.Test/Actuators/Refresh/RefreshActuatorTest.cs b/src/Management/test/Endpoint.Test/Actuators/Refresh/RefreshActuatorTest.cs index 7ede0f15bd..1f1862a847 100644 --- a/src/Management/test/Endpoint.Test/Actuators/Refresh/RefreshActuatorTest.cs +++ b/src/Management/test/Endpoint.Test/Actuators/Refresh/RefreshActuatorTest.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Net; -using System.Net.Http.Json; using System.Text.Json.Nodes; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.TestHost; diff --git a/src/Management/test/Endpoint.Test/Actuators/RouteMappings/RouteMappingsActuatorTest.cs b/src/Management/test/Endpoint.Test/Actuators/RouteMappings/RouteMappingsActuatorTest.cs index 6c63c31926..0f5af012b0 100644 --- a/src/Management/test/Endpoint.Test/Actuators/RouteMappings/RouteMappingsActuatorTest.cs +++ b/src/Management/test/Endpoint.Test/Actuators/RouteMappings/RouteMappingsActuatorTest.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Net; -using System.Net.Http.Json; using System.Text.Json.Nodes; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; diff --git a/src/Management/test/Endpoint.Test/Actuators/ThreadDump/EventPipeThreadDumperTest.cs b/src/Management/test/Endpoint.Test/Actuators/ThreadDump/EventPipeThreadDumperTest.cs index 64bba99879..b95a8b86af 100644 --- a/src/Management/test/Endpoint.Test/Actuators/ThreadDump/EventPipeThreadDumperTest.cs +++ b/src/Management/test/Endpoint.Test/Actuators/ThreadDump/EventPipeThreadDumperTest.cs @@ -110,15 +110,6 @@ public static void BackgroundThreadCallback(object? argument) while (!cancellationToken.IsCancellationRequested) { counter++; -#if NET8_0 - if (counter % 100_000 == 0) - { - // Periodically yield to allow the EventPipe rundown thread to make progress on .NET 8, otherwise this thread can starve it of CPU time - // on constrained/busy machines (such as CI runners), making the dump take tens of seconds instead of a few hundred milliseconds. - // This is in native code, but yielding only occasionally (instead of every iteration) keeps the odds of a sample landing inside it low. - Thread.Sleep(0); - } -#endif } _ = counter; diff --git a/src/Management/test/Endpoint.Test/SpringBootAdminClient/HostBuilderTest.cs b/src/Management/test/Endpoint.Test/SpringBootAdminClient/HostBuilderTest.cs index 4c4843ee9d..fb17bd9bd1 100644 --- a/src/Management/test/Endpoint.Test/SpringBootAdminClient/HostBuilderTest.cs +++ b/src/Management/test/Endpoint.Test/SpringBootAdminClient/HostBuilderTest.cs @@ -4,7 +4,6 @@ using System.Globalization; using System.Net; -using System.Net.Http.Json; using System.Runtime.InteropServices; using System.Text; using FluentAssertions.Extensions; diff --git a/src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj b/src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj index 85b9af34bb..493f49eaa2 100644 --- a/src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj +++ b/src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 @@ -19,9 +19,9 @@ - - - + + + diff --git a/src/Management/test/GitProperties.Build.Test/GitRepositoryBuilder.cs b/src/Management/test/GitProperties.Build.Test/GitRepositoryBuilder.cs index 16b01e875b..2a6ef48666 100644 --- a/src/Management/test/GitProperties.Build.Test/GitRepositoryBuilder.cs +++ b/src/Management/test/GitProperties.Build.Test/GitRepositoryBuilder.cs @@ -14,12 +14,15 @@ internal static class GitRepositoryBuilder gpgsign = false # Avoid an interactive prompt on a machine that has commit signing configured globally. """; +#pragma warning disable IDE0028 // Simplify collection initialization + // Justification: ReSharper doesn't yet support the new 'with' syntax in collection initializers. private static readonly HashSet DirectoryNamesExcludedInPush = new(StringComparer.OrdinalIgnoreCase) { ".git", "bin", "obj" }; +#pragma warning restore IDE0028 // Simplify collection initialization public static async Task InitializeEmptyAsync(string destination) { diff --git a/src/Management/test/GitProperties.Build.Test/Steeltoe.Management.GitProperties.Build.Test.csproj b/src/Management/test/GitProperties.Build.Test/Steeltoe.Management.GitProperties.Build.Test.csproj index 74b0e57f71..0b1240c9f0 100644 --- a/src/Management/test/GitProperties.Build.Test/Steeltoe.Management.GitProperties.Build.Test.csproj +++ b/src/Management/test/GitProperties.Build.Test/Steeltoe.Management.GitProperties.Build.Test.csproj @@ -4,7 +4,7 @@ No test's outcome depends on which TFM this assembly itself is compiled as, so multi-targeting would just triple the suite's runtime for zero extra coverage. --> - net10.0 + net11.0 diff --git a/src/Management/test/Prometheus.Test/Steeltoe.Management.Prometheus.Test.csproj b/src/Management/test/Prometheus.Test/Steeltoe.Management.Prometheus.Test.csproj index 484afb7186..e19b42e80e 100644 --- a/src/Management/test/Prometheus.Test/Steeltoe.Management.Prometheus.Test.csproj +++ b/src/Management/test/Prometheus.Test/Steeltoe.Management.Prometheus.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Management/test/RazorPagesTestWebApp/Steeltoe.Management.Endpoint.RazorPagesTestWebApp.csproj b/src/Management/test/RazorPagesTestWebApp/Steeltoe.Management.Endpoint.RazorPagesTestWebApp.csproj index 69cfd6dd8d..080072aa8e 100644 --- a/src/Management/test/RazorPagesTestWebApp/Steeltoe.Management.Endpoint.RazorPagesTestWebApp.csproj +++ b/src/Management/test/RazorPagesTestWebApp/Steeltoe.Management.Endpoint.RazorPagesTestWebApp.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 false diff --git a/src/Management/test/Tasks.Test/Steeltoe.Management.Tasks.Test.csproj b/src/Management/test/Tasks.Test/Steeltoe.Management.Tasks.Test.csproj index c8c75a12ee..3f72d6ad20 100644 --- a/src/Management/test/Tasks.Test/Steeltoe.Management.Tasks.Test.csproj +++ b/src/Management/test/Tasks.Test/Steeltoe.Management.Tasks.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Management/test/Tracing.Test/Steeltoe.Management.Tracing.Test.csproj b/src/Management/test/Tracing.Test/Steeltoe.Management.Tracing.Test.csproj index c28991c23d..b7980dbda1 100644 --- a/src/Management/test/Tracing.Test/Steeltoe.Management.Tracing.Test.csproj +++ b/src/Management/test/Tracing.Test/Steeltoe.Management.Tracing.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Security/src/Authentication.JwtBearer/Steeltoe.Security.Authentication.JwtBearer.csproj b/src/Security/src/Authentication.JwtBearer/Steeltoe.Security.Authentication.JwtBearer.csproj index 658280892f..3a9f044e72 100644 --- a/src/Security/src/Authentication.JwtBearer/Steeltoe.Security.Authentication.JwtBearer.csproj +++ b/src/Security/src/Authentication.JwtBearer/Steeltoe.Security.Authentication.JwtBearer.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Library for using JWT Bearer tokens with UAA-based systems, including Cloud Foundry. CloudFoundry;uaa;security;jwt;bearer;tanzu;aspnetcore true diff --git a/src/Security/src/Authentication.OpenIdConnect/Steeltoe.Security.Authentication.OpenIdConnect.csproj b/src/Security/src/Authentication.OpenIdConnect/Steeltoe.Security.Authentication.OpenIdConnect.csproj index 8808318eb1..0c08071f38 100644 --- a/src/Security/src/Authentication.OpenIdConnect/Steeltoe.Security.Authentication.OpenIdConnect.csproj +++ b/src/Security/src/Authentication.OpenIdConnect/Steeltoe.Security.Authentication.OpenIdConnect.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Library for using OpenID Connect with UAA-based systems, including Cloud Foundry. CloudFoundry;uaa;security;sso;openid;oidc;tanzu;aspnetcore true diff --git a/src/Security/src/Authorization.Certificate/CertificateHttpClientBuilderExtensions.cs b/src/Security/src/Authorization.Certificate/CertificateHttpClientBuilderExtensions.cs index 98343c5cca..994e65f0c1 100644 --- a/src/Security/src/Authorization.Certificate/CertificateHttpClientBuilderExtensions.cs +++ b/src/Security/src/Authorization.Certificate/CertificateHttpClientBuilderExtensions.cs @@ -125,10 +125,9 @@ public static IHttpClientBuilder AddClientCertificate(this IHttpClientBuilder bu /// /// mTLS requires as the primary handler. If a has already been configured (for /// example, via ), it is reused and the client certificate is - /// applied to it. If no handler was explicitly configured, a new is created. On .NET 9 and later, configuring any - /// other primary handler type causes an when the first request is made; on .NET 8, it is silently replaced. - /// This configuration always runs after any calls to , regardless - /// of registration order. + /// applied to it. If no handler was explicitly configured, a new is created. Configuring any other primary handler + /// type causes an when the first request is made. This configuration always runs after any calls to + /// , regardless of registration order. /// /// /// The incoming so that additional calls can be chained. @@ -150,10 +149,9 @@ public static IHttpClientBuilder AddAppInstanceIdentityCertificateForMutualTls(t /// /// mTLS requires as the primary handler. If a has already been configured (for /// example, via ), it is reused and the client certificate is - /// applied to it. If no handler was explicitly configured, a new is created. On .NET 9 and later, configuring any - /// other primary handler type causes an when the first request is made; on .NET 8, it is silently replaced. - /// This configuration always runs after any calls to , regardless - /// of registration order. + /// applied to it. If no handler was explicitly configured, a new is created. Configuring any other primary handler + /// type causes an when the first request is made. This configuration always runs after any calls to + /// , regardless of registration order. /// /// /// The incoming so that additional calls can be chained. @@ -191,20 +189,11 @@ public static IHttpClientBuilder AddClientCertificateForMutualTls(this IHttpClie } else { - // On .NET 9+, PrimaryHandler defaults to SocketsHttpHandler; reaching this branch means the + // PrimaryHandler defaults to SocketsHttpHandler; reaching this branch means the // user explicitly configured an incompatible handler type, which is an error. - // On .NET 8, PrimaryHandler defaults to HttpClientHandler, so replacement is expected - // and logged at Debug rather than treated as an error. - if (Environment.Version.Major >= 9) - { - throw new InvalidOperationException($"HttpClient '{builder.Name}' has an incompatible primary handler " + - $"'{handlerBuilder.PrimaryHandler.GetType().Name}'. mTLS requires SocketsHttpHandler. " + - $"Call ConfigurePrimaryHttpMessageHandler() or remove the ConfigurePrimaryHttpMessageHandler call."); - } - - LogReplacingPrimaryHttpMessageHandler(logger, builder.Name); - - socketsHandler = new SocketsHttpHandler(); + throw new InvalidOperationException($"HttpClient '{builder.Name}' has an incompatible primary handler " + + $"'{handlerBuilder.PrimaryHandler.GetType().Name}'. mTLS requires SocketsHttpHandler. " + + $"Call ConfigurePrimaryHttpMessageHandler() or remove the ConfigurePrimaryHttpMessageHandler call."); } if (certificateContext == null) diff --git a/src/Security/src/Authorization.Certificate/Steeltoe.Security.Authorization.Certificate.csproj b/src/Security/src/Authorization.Certificate/Steeltoe.Security.Authorization.Certificate.csproj index 5f75794484..d0654e2bc5 100644 --- a/src/Security/src/Authorization.Certificate/Steeltoe.Security.Authorization.Certificate.csproj +++ b/src/Security/src/Authorization.Certificate/Steeltoe.Security.Authorization.Certificate.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Provides support for authorization with client certificates. authorization;security;x509;certificate;mutualtls;CloudFoundry;tanzu;aspnetcore true diff --git a/src/Security/src/DataProtection.Redis/Steeltoe.Security.DataProtection.Redis.csproj b/src/Security/src/DataProtection.Redis/Steeltoe.Security.DataProtection.Redis.csproj index 6d7a61d9fe..f39204aff7 100644 --- a/src/Security/src/DataProtection.Redis/Steeltoe.Security.DataProtection.Redis.csproj +++ b/src/Security/src/DataProtection.Redis/Steeltoe.Security.DataProtection.Redis.csproj @@ -1,6 +1,6 @@ - + - net10.0;net8.0 + net11.0;net10.0 Support for storing data protection keys in Redis. CloudFoundry;security;dataprotection;redis;aspnetcore true diff --git a/src/Security/test/Authentication.JwtBearer.Test/Steeltoe.Security.Authentication.JwtBearer.Test.csproj b/src/Security/test/Authentication.JwtBearer.Test/Steeltoe.Security.Authentication.JwtBearer.Test.csproj index abdce38f96..605cfbb869 100644 --- a/src/Security/test/Authentication.JwtBearer.Test/Steeltoe.Security.Authentication.JwtBearer.Test.csproj +++ b/src/Security/test/Authentication.JwtBearer.Test/Steeltoe.Security.Authentication.JwtBearer.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Security/test/Authentication.OpenIdConnect.Test/Steeltoe.Security.Authentication.OpenIdConnect.Test.csproj b/src/Security/test/Authentication.OpenIdConnect.Test/Steeltoe.Security.Authentication.OpenIdConnect.Test.csproj index 7a11ec9e00..6046fa24ca 100644 --- a/src/Security/test/Authentication.OpenIdConnect.Test/Steeltoe.Security.Authentication.OpenIdConnect.Test.csproj +++ b/src/Security/test/Authentication.OpenIdConnect.Test/Steeltoe.Security.Authentication.OpenIdConnect.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.Legacy.cs b/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.Legacy.cs index bdc346541a..c48a58095f 100644 --- a/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.Legacy.cs +++ b/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.Legacy.cs @@ -160,11 +160,7 @@ public async Task AddAppInstanceIdentityCertificate_ObsoleteDefaultOverload_Head private static X509Certificate2 CreateCertificateFromRawData(byte[] rawData) { -#if NET9_0_OR_GREATER return X509CertificateLoader.LoadCertificate(rawData); -#else - return new X509Certificate2(rawData); -#endif } private static HostBuilder GetHostBuilderWithCustomHeader(string certificateHeaderName) diff --git a/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.cs b/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.cs index d4db8c0fc2..b8fbee81cf 100644 --- a/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.cs +++ b/src/Security/test/Authorization.Certificate.Test/CertificateHttpClientBuilderExtensionsTest.cs @@ -129,43 +129,6 @@ public async Task AddClientCertificate_ExistingSocketsHttpHandler_IsReusedAndCer socketsHandler.SslOptions.ClientCertificateContext.Should().NotBeNull(); } - [Fact] - public async Task AddClientCertificate_IncompatiblePrimaryHandler_OnDotNet8_LogsReplacementAtDebugLevel() - { - if (Environment.Version.Major >= 9) - { - Assert.Skip("On .NET 9+, an explicitly configured incompatible primary handler throws instead of being replaced."); - } - - using var appScope = new EnvironmentVariableScope("VCAP_APPLICATION", "{}"); - using var certScope = new EnvironmentVariableScope("CF_INSTANCE_CERT", "instance.crt"); - using var keyScope = new EnvironmentVariableScope("CF_INSTANCE_KEY", "instance.key"); - - using var loggerProvider = new CapturingLoggerProvider((category, level) => - category == typeof(CertificateHttpClientBuilderExtensions).FullName && level == LogLevel.Debug); - - // ReSharper disable once AccessToDisposedClosure - HostBuilder hostBuilder = GetHostBuilder(builder => - { - builder.ConfigureLogging(logging => logging.SetMinimumLevel(LogLevel.Debug).AddProvider(loggerProvider)); - - builder.ConfigureServices(services => - services.AddHttpClient("test").AddClientCertificateForMutualTls(CertificateConfigurationExtensions.AppInstanceIdentityCertificateName)); - }); - - using IHost host = await hostBuilder.StartAsync(TestContext.Current.CancellationToken); - - var handlerFactory = host.Services.GetRequiredService(); - using HttpMessageHandler handler = handlerFactory.CreateHandler("test"); - SocketsHttpHandler socketsHandler = GetInnerHandler(handler).Should().BeOfType().Which; - socketsHandler.SslOptions.ClientCertificateContext.Should().NotBeNull(); - - IList logMessages = loggerProvider.GetAll(); - - logMessages.Should().ContainSingle().Which.Should().Be( - $"DBUG {typeof(CertificateHttpClientBuilderExtensions)}: Replacing the PrimaryHandler on HttpClient 'test' with a new SocketsHttpHandler."); - } - [Fact] public async Task AddClientCertificateForMutualTls_CertificateNotConfigured_LogsErrorAndSkipsClientCertificate() { @@ -194,13 +157,8 @@ public async Task AddClientCertificateForMutualTls_CertificateNotConfigured_Logs } [Fact] - public async Task AddClientCertificate_IncompatiblePrimaryHandler_OnDotNet9Plus_ThrowsInvalidOperationException() + public async Task AddClientCertificate_IncompatiblePrimaryHandler_ThrowsInvalidOperationException() { - if (Environment.Version.Major < 9) - { - Assert.Skip("On .NET 8, an incompatible primary handler is replaced with a Debug log rather than throwing."); - } - using var appScope = new EnvironmentVariableScope("VCAP_APPLICATION", "{}"); using var certScope = new EnvironmentVariableScope("CF_INSTANCE_CERT", "instance.crt"); using var keyScope = new EnvironmentVariableScope("CF_INSTANCE_KEY", "instance.key"); @@ -268,11 +226,7 @@ private static X509Certificate2 CreateTestServerCertificate() using X509Certificate2 ephemeral = request.CreateSelfSigned(DateTimeOffset.UtcNow.AddSeconds(-1), DateTimeOffset.UtcNow.AddHours(1)); byte[] pkcs12Bytes = ephemeral.Export(X509ContentType.Pkcs12); -#if NET9_0_OR_GREATER return X509CertificateLoader.LoadPkcs12(pkcs12Bytes, null, X509KeyStorageFlags.UserKeySet); -#else - return new X509Certificate2(pkcs12Bytes, (string?)null, X509KeyStorageFlags.UserKeySet); -#endif } private static HttpMessageHandler GetInnerHandler(HttpMessageHandler handler) diff --git a/src/Security/test/Authorization.Certificate.Test/Steeltoe.Security.Authorization.Certificate.Test.csproj b/src/Security/test/Authorization.Certificate.Test/Steeltoe.Security.Authorization.Certificate.Test.csproj index 9235a977d6..0d9eb272a0 100644 --- a/src/Security/test/Authorization.Certificate.Test/Steeltoe.Security.Authorization.Certificate.Test.csproj +++ b/src/Security/test/Authorization.Certificate.Test/Steeltoe.Security.Authorization.Certificate.Test.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 diff --git a/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.cs b/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.cs index 112d7a246f..5248c87453 100644 --- a/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.cs +++ b/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.cs @@ -12,12 +12,14 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Microsoft.Net.Http.Headers; +using NSubstitute; +using StackExchange.Redis; using Steeltoe.Common.TestResources; using Steeltoe.Connectors.Redis; namespace Steeltoe.Security.DataProtection.Redis.Test; -public sealed partial class RedisDataProtectionBuilderExtensionsTest +public sealed class RedisDataProtectionBuilderExtensionsTest { [Fact] public async Task Stores_session_state_in_Redis() @@ -96,4 +98,50 @@ public async Task Stores_session_state_in_Redis() string responseContent = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken); responseContent.Should().Be("example-value"); } + + private static object GetMockedConnectionMultiplexer(string? connectionString) + { + Dictionary innerStore = []; + + var database = Substitute.For(); + database.HashGet(Arg.Any(), Arg.Any(), Arg.Any()).Returns(info => GetRedisValues(info.Arg())); + + database.HashGetAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(info => Task.FromResult(GetRedisValues(info.Arg()))); + + database.HashSetAsync(Arg.Any(), Arg.Any(), Arg.Any()).Returns(info => + { + var key = info.Arg(); + HashEntry[] hashFields = info.Arg(); + + byte[] data = hashFields[2].Value!; + innerStore[key!] = data; + return Task.CompletedTask; + }); + + var connectionMultiplexer = Substitute.For(); + connectionMultiplexer.Configuration.Returns(connectionString); + connectionMultiplexer.GetDatabase(Arg.Any(), Arg.Any()).Returns(database); + + database.Multiplexer.Returns(connectionMultiplexer); + + return connectionMultiplexer; + + RedisValue[] GetRedisValues(RedisKey key) + { + return innerStore.TryGetValue(key!, out byte[]? data) + ? + [ + default, + default, + data + ] + : + [ + default, + default, + default + ]; + } + } } diff --git a/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.net80.cs b/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.net80.cs deleted file mode 100644 index b5f9d21ffd..0000000000 --- a/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.net80.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using NSubstitute; -using StackExchange.Redis; - -namespace Steeltoe.Security.DataProtection.Redis.Test; - -partial class RedisDataProtectionBuilderExtensionsTest -{ - private static object GetMockedConnectionMultiplexer(string? connectionString) - { - Dictionary innerStore = []; - - var database = Substitute.For(); - database.HashGet(Arg.Any(), Arg.Any(), Arg.Any()).Returns(info => GetRedisValues(info.Arg())); - - database.HashGetAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(info => Task.FromResult(GetRedisValues(info.Arg()))); - - database.ScriptEvaluateAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()).Returns(info => - { - RedisKey[]? keys = info.Arg(); - RedisValue[]? values = info.Arg(); - - innerStore[keys![0]!] = values![3]!; - return Task.FromResult(RedisResult.Create(keys[0])); - }); - - var connectionMultiplexer = Substitute.For(); - connectionMultiplexer.Configuration.Returns(connectionString); - connectionMultiplexer.GetDatabase(Arg.Any(), Arg.Any()).Returns(database); - - database.Multiplexer.Returns(connectionMultiplexer); - - return connectionMultiplexer; - - RedisValue[] GetRedisValues(RedisKey key) - { - return innerStore.TryGetValue(key!, out byte[]? data) - ? - [ - default, - default, - data - ] - : - [ - default, - default, - default - ]; - } - } -} diff --git a/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.other.cs b/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.other.cs deleted file mode 100644 index 63e380a27a..0000000000 --- a/src/Security/test/DataProtection.Redis.Test/RedisDataProtectionBuilderExtensionsTest.other.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using NSubstitute; -using StackExchange.Redis; - -namespace Steeltoe.Security.DataProtection.Redis.Test; - -partial class RedisDataProtectionBuilderExtensionsTest -{ - private static object GetMockedConnectionMultiplexer(string? connectionString) - { - Dictionary innerStore = []; - - var database = Substitute.For(); - database.HashGet(Arg.Any(), Arg.Any(), Arg.Any()).Returns(info => GetRedisValues(info.Arg())); - - database.HashGetAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(info => Task.FromResult(GetRedisValues(info.Arg()))); - - database.HashSetAsync(Arg.Any(), Arg.Any(), Arg.Any()).Returns(info => - { - var key = info.Arg(); - HashEntry[] hashFields = info.Arg(); - - byte[] data = hashFields[2].Value!; - innerStore[key!] = data; - return Task.CompletedTask; - }); - - var connectionMultiplexer = Substitute.For(); - connectionMultiplexer.Configuration.Returns(connectionString); - connectionMultiplexer.GetDatabase(Arg.Any(), Arg.Any()).Returns(database); - - database.Multiplexer.Returns(connectionMultiplexer); - - return connectionMultiplexer; - - RedisValue[] GetRedisValues(RedisKey key) - { - return innerStore.TryGetValue(key!, out byte[]? data) - ? - [ - default, - default, - data - ] - : - [ - default, - default, - default - ]; - } - } -} diff --git a/src/Security/test/DataProtection.Redis.Test/Steeltoe.Security.DataProtection.Redis.Test.csproj b/src/Security/test/DataProtection.Redis.Test/Steeltoe.Security.DataProtection.Redis.Test.csproj index 5de5a0bade..0fa35f44ca 100644 --- a/src/Security/test/DataProtection.Redis.Test/Steeltoe.Security.DataProtection.Redis.Test.csproj +++ b/src/Security/test/DataProtection.Redis.Test/Steeltoe.Security.DataProtection.Redis.Test.csproj @@ -1,30 +1,11 @@ - net10.0;net9.0;net8.0 + net11.0;net10.0 - - - - - - - - - - - - - - - diff --git a/src/Tools/src/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj b/src/Tools/src/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj index f599ae2702..e5140f2342 100644 --- a/src/Tools/src/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj +++ b/src/Tools/src/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj @@ -1,6 +1,6 @@ - net8.0 + net10.0 false Exe enable @@ -17,7 +17,6 @@ - diff --git a/src/Tools/test/ConfigurationSchemaGenerator.Tests/ConfigurationSchemaGenerator.Tests.csproj b/src/Tools/test/ConfigurationSchemaGenerator.Tests/ConfigurationSchemaGenerator.Tests.csproj index eeb1f5cf99..d567152a83 100644 --- a/src/Tools/test/ConfigurationSchemaGenerator.Tests/ConfigurationSchemaGenerator.Tests.csproj +++ b/src/Tools/test/ConfigurationSchemaGenerator.Tests/ConfigurationSchemaGenerator.Tests.csproj @@ -1,6 +1,6 @@ - + - net10.0;net9.0;net8.0 + net11.0;net10.0 true true true diff --git a/versions.props b/versions.props index 683a00041c..8237ff998d 100644 --- a/versions.props +++ b/versions.props @@ -6,7 +6,7 @@ --> 9.0.* - 10.1.* + 10.0.* 7.2.* 3.62.* 18.9.* @@ -33,16 +33,12 @@ 4.0.* - - 8.0.* - - - - 9.0.* + + 10.0.* - - 10.0.* + + 10.0.* @@ -56,11 +52,10 @@ 2.2.* 1.8.* 10.0.745401 - 8.0.* 10.0.* @@ -72,38 +67,30 @@ 10.0.* 6.1.* 9.0.* + 11.0.*-* - - - - 8.0.* - - - - + + 10.0.* - 9.0.* + 10.0.* - + + 11.0.*-* - 10.0.* + 11.0.*-*