Skip to content

Commit 61ce45b

Browse files
authored
Merge pull request #16 from null-d3v/net9.0
net9.0
2 parents 527a376 + 0949c66 commit 61ce45b

File tree

10 files changed

+63
-38
lines changed

10 files changed

+63
-38
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
[
99
"ms-dotnettools.csdevkit",
1010
"ue.alphabetical-sorter"
11-
]
11+
],
12+
"settings":
13+
{
14+
"remote.autoForwardPorts": false
15+
}
1216
}
1317
},
1418
"forwardPorts":

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
devcontainer:
3-
image: mcr.microsoft.com/devcontainers/dotnet:8.0-bookworm
3+
image: mcr.microsoft.com/devcontainers/dotnet:9.0-bookworm
44
volumes:
55
- ..:/workspace:cached
66
command: sleep infinity

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[*.{cs,vb}]
2+
3+
dotnet_diagnostic.severity = warning
4+
dotnet_diagnostic.CS1591.severity = none
5+
dotnet_diagnostic.IDE0001.severity = warning
6+
dotnet_diagnostic.IDE0007.severity = warning
7+
dotnet_diagnostic.IDE0008.severity = none
8+
dotnet_diagnostic.IDE0010.severity = none
9+
dotnet_diagnostic.IDE0028.severity = warning
10+
dotnet_diagnostic.IDE0055.severity = none
11+
dotnet_diagnostic.IDE0058.severity = none
12+
dotnet_diagnostic.IDE0090.severity = warning
13+
dotnet_diagnostic.IDE0160.severity = none
14+
dotnet_diagnostic.IDE0161.severity = warning
15+
dotnet_diagnostic.IDE0290.severity = warning
16+
dotnet_diagnostic.IDE0300.severity = warning
17+
dotnet_diagnostic.IDE0301.severity = warning
18+
dotnet_diagnostic.IDE0303.severity = warning
19+
dotnet_diagnostic.IDE0305.severity = warning
20+
21+
csharp_space_between_square_brackets = true
22+
csharp_style_var_elsewhere = true:warning
23+
csharp_style_var_for_built_in_types = true:warning
24+
csharp_style_var_when_type_is_apparent = true:warning
25+
dotnet_style_namespace_match_folder = false
26+
dotnet_style_prefer_conditional_expression_over_return = false

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ jobs:
1010
- name: Test
1111
uses: devcontainers/[email protected]
1212
with:
13-
push: never
14-
runCmd: dotnet test
13+
push: never
14+
runCmd: dotnet test

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- name: Test
1616
uses: devcontainers/[email protected]
1717
with:
18-
push: never
19-
runCmd: dotnet test
18+
push: never
19+
runCmd: dotnet test
2020
- name: Publish
2121
uses: devcontainers/[email protected]
2222
with:
23-
push: never
24-
runCmd: dotnet build -c Release && dotnet nuget push "**/*.nupkg" -k ${{ secrets.NUGET_KEY }} -n -s https://api.nuget.org/v3/index.json --skip-duplicate
23+
push: never
24+
runCmd: dotnet build -c Release && dotnet nuget push "**/*.nupkg" -k ${{ secrets.NUGET_KEY }} -n -s https://api.nuget.org/v3/index.json --skip-duplicate

src/Configuration/ServiceCollectionExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Microsoft.Extensions.Caching.StackExchangeRedis;
44
using Microsoft.Extensions.Options;
55
using StackExchange.Redis;
6-
using System.Diagnostics.CodeAnalysis;
76

87
namespace Microsoft.Extensions.DependencyInjection;
98

@@ -16,7 +15,6 @@ public static class ServiceCollectionExtensions
1615
/// Adds L1L2RedisCache distributed caching services to the specified <c>IServiceCollection</c>.
1716
/// </summary>
1817
/// <returns>The <c>IServiceCollection</c> so that additional calls can be chained.</returns>
19-
[SuppressMessage("Performance", "CA1849")]
2018
public static IServiceCollection AddL1L2RedisCache(
2119
this IServiceCollection services,
2220
Action<L1L2RedisCacheOptions> setupAction)

src/L1L2RedisCache.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Microsoft.Extensions.Caching.Distributed;
22
using Microsoft.Extensions.Caching.Memory;
33
using Microsoft.Extensions.Logging;
4+
using Microsoft.Extensions.Logging.Abstractions;
45
using Microsoft.Extensions.Options;
56
using StackExchange.Redis;
6-
using System.Diagnostics.CodeAnalysis;
77

88
namespace L1L2RedisCache;
99

@@ -35,7 +35,8 @@ public L1L2RedisCache(
3535
L2Cache = l2CacheAccessor?.Invoke() ??
3636
throw new ArgumentNullException(
3737
nameof(l2CacheAccessor));
38-
Logger = logger;
38+
Logger = logger ??
39+
NullLogger<L1L2RedisCache>.Instance;
3940
MessagePublisher = messagePublisher ??
4041
throw new ArgumentNullException(
4142
nameof(messagePublisher));
@@ -87,7 +88,7 @@ public L1L2RedisCache(
8788
/// <summary>
8889
/// Optional. The logger.
8990
/// </summary>
90-
public ILogger<L1L2RedisCache>? Logger { get; }
91+
public ILogger<L1L2RedisCache> Logger { get; }
9192

9293
/// <summary>
9394
/// The pub/sub publisher.
@@ -121,7 +122,6 @@ public void Dispose()
121122
/// </summary>
122123
/// <param name="key">A string identifying the requested value.</param>
123124
/// <returns>The located value or null.</returns>
124-
[SuppressMessage("Reliability", "CA2000")]
125125
public byte[]? Get(string key)
126126
{
127127
var value = L1Cache.Get(
@@ -245,7 +245,6 @@ await L2Cache
245245
/// Removes the value with the given key.
246246
/// </summary>
247247
/// <param name="key">A string identifying the requested value.</param>
248-
[SuppressMessage("Reliability", "CA2000")]
249248
public void Remove(string key)
250249
{
251250
var semaphore = GetOrCreateLock(key, null);
@@ -313,7 +312,6 @@ await MessagePublisher
313312
/// <param name="key">A string identifying the requested value.</param>
314313
/// <param name="value">The value to set in the cache.</param>
315314
/// <param name="options">The cache options for the value.</param>
316-
[SuppressMessage("Reliability", "CA2000")]
317315
public void Set(
318316
string key,
319317
byte[] value,
@@ -456,7 +454,6 @@ private SemaphoreSlim GetOrCreateLock(
456454
}
457455
}
458456

459-
[SuppressMessage("Reliability", "CA2000")]
460457
private async Task<SemaphoreSlim> GetOrCreateLockAsync(
461458
string key,
462459
DistributedCacheEntryOptions? distributedCacheEntryOptions,
@@ -547,7 +544,7 @@ private async Task SubscribeAsync(
547544
cancellationToken)
548545
.ConfigureAwait(false))
549546
{
550-
Logger?.MessagingConfigurationInvalid(
547+
Logger.MessagingConfigurationInvalid(
551548
L1L2RedisCacheOptions.MessagingType);
552549
}
553550

@@ -560,7 +557,7 @@ await MessageSubscriber
560557
}
561558
catch (RedisConnectionException redisConnectionException)
562559
{
563-
Logger?.SubscriberFailed(
560+
Logger.SubscriberFailed(
564561
L1L2RedisCacheOptions
565562
.SubscriberRetryDelay,
566563
redisConnectionException);

src/L1L2RedisCache.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<AnalysisLevel>latest-all</AnalysisLevel>
3+
<AnalysisLevel>latest-recommended</AnalysisLevel>
44
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -17,10 +17,10 @@
1717
<None Include="../README.md" Pack="true" PackagePath="\" />
1818
</ItemGroup>
1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.*" />
21-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.*" />
22-
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.*" />
23-
<PackageReference Include="System.Text.Json" Version="8.0.*" />
20+
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.*" />
21+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.*" />
22+
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.*" />
23+
<PackageReference Include="System.Text.Json" Version="9.0.*" />
2424
</ItemGroup>
2525
<ItemGroup>
2626
<InternalsVisibleTo Include="L1L2RedisCache.Tests.System" />
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<AnalysisLevel>latest-all</AnalysisLevel>
3+
<AnalysisLevel>latest-recommended</AnalysisLevel>
44
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<IsPackable>false</IsPackable>
77
<Nullable>enable</Nullable>
8-
<TargetFramework>net8.0</TargetFramework>
8+
<TargetFramework>net9.0</TargetFramework>
99
</PropertyGroup>
1010
<ItemGroup>
1111
<None CopyToOutputDirectory="PreserveNewest" Include="appsettings.json" />
@@ -16,13 +16,13 @@
1616
<ItemGroup>
1717
<PackageReference Include="BenchmarkDotNet" Version="0.14.*" />
1818
<PackageReference Include="coverlet.collector" Version="6.0.*" />
19-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.*" />
20-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.*" />
21-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.*" />
22-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.*" />
23-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.*" />
19+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.*" />
20+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.*" />
21+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.*" />
22+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.*" />
23+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.*" />
2424
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.*" />
25-
<PackageReference Include="MSTest.TestAdapter" Version="3.5.*" />
26-
<PackageReference Include="MSTest.TestFramework" Version="3.5.*" />
25+
<PackageReference Include="MSTest.TestAdapter" Version="3.6.*" />
26+
<PackageReference Include="MSTest.TestFramework" Version="3.6.*" />
2727
</ItemGroup>
2828
</Project>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<AnalysisLevel>latest-all</AnalysisLevel>
3+
<AnalysisLevel>latest-recommended</AnalysisLevel>
44
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<IsPackable>false</IsPackable>
77
<Nullable>enable</Nullable>
8-
<TargetFramework>net8.0</TargetFramework>
8+
<TargetFramework>net9.0</TargetFramework>
99
</PropertyGroup>
1010
<ItemGroup>
1111
<ProjectReference Include="..\..\src\L1L2RedisCache.csproj" />
1212
</ItemGroup>
1313
<ItemGroup>
1414
<PackageReference Include="coverlet.collector" Version="6.0.*" />
1515
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.*" />
16-
<PackageReference Include="MSTest.TestAdapter" Version="3.5.*" />
17-
<PackageReference Include="MSTest.TestFramework" Version="3.5.*" />
18-
<PackageReference Include="NSubstitute" Version="5.1.*" />
16+
<PackageReference Include="MSTest.TestAdapter" Version="3.6.*" />
17+
<PackageReference Include="MSTest.TestFramework" Version="3.6.*" />
18+
<PackageReference Include="NSubstitute" Version="5.3.*" />
1919
</ItemGroup>
2020
</Project>

0 commit comments

Comments
 (0)