Skip to content

Commit 1e4c063

Browse files
authored
Merge pull request #37 from autofac/feature/net8
Update for .NET 8, Autofac 8.
2 parents d738881 + cc156ae commit 1e4c063

File tree

9 files changed

+34
-26
lines changed

9 files changed

+34
-26
lines changed

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
image: Ubuntu
22

3-
version: '7.0.1.{build}'
3+
version: '8.0.0.{build}'
44

55
dotnet_csproj:
6-
version_prefix: '7.0.1'
6+
version_prefix: '8.0.0'
77
patch: true
88
file: 'src\**\*.csproj'
99

build/Analyzers.ruleset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<Rule Id="CA1510" Action="None" />
99
<!-- Change names to avoid reserved word overlaps (e.g., Delegate, GetType, etc.) - too many of these in the public API, we'd break if we fixed it. -->
1010
<Rule Id="CA1716" Action="None" />
11+
<!-- Cache a 'CompositeFormat' for repeated use in formatting - we only format exception messages and this isn't supported in other .NET targets, so it's not interesting to optimize. -->
12+
<Rule Id="CA1863" Action="None" />
1113
<!-- Implement serialization constructors - false positive when building .NET Core -->
1214
<Rule Id="CA2229" Action="None" />
1315
<!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core -->

build/Test.ruleset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<Rule Id="CA1822" Action="None" />
1515
<!-- Seal internal types - tests use internal types for stubs and performance isn't a problem; this causes unnecessary ceremony. -->
1616
<Rule Id="CA1852" Action="None" />
17+
<!-- Call ConfigureAwait - conflicts with xUnit1030 and may cause test parallelization limits to be bypassed. -->
18+
<Rule Id="CA2007" Action="None" />
1719
<!-- Implement serialization constructors - false positive when building .NET Core -->
1820
<Rule Id="CA2229" Action="None" />
1921
<!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core -->

global.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"sdk": {
3-
"version": "7.0.306",
3+
"version": "8.0.101",
44
"rollForward": "latestFeature"
5-
}
5+
},
6+
"additionalSdks": [
7+
"6.0.418",
8+
"7.0.405"
9+
]
610
}

src/Autofac.Multitenant/Autofac.Multitenant.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<SignAssembly>true</SignAssembly>
1515
<NeutralLanguage>en-US</NeutralLanguage>
1616
<!-- Frameworks and language features -->
17-
<TargetFrameworks>net7.0;net6.0;netstandard2.1;netstandard2.0;</TargetFrameworks>
17+
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.1;netstandard2.0</TargetFrameworks>
1818
<LangVersion>latest</LangVersion>
1919
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2020
<Nullable>enable</Nullable>
@@ -61,15 +61,15 @@
6161
</ItemGroup>
6262

6363
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
64-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
64+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
6565
</ItemGroup>
6666

6767
<ItemGroup>
68-
<PackageReference Include="Autofac" Version="7.1.0" />
69-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" Condition="Exists('$(MSBuildThisFileDirectory)../../.git')">
68+
<PackageReference Include="Autofac" Version="8.0.0" />
69+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" Condition="Exists('$(MSBuildThisFileDirectory)../../.git')">
7070
<PrivateAssets>all</PrivateAssets>
7171
</PackageReference>
72-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
72+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
7373
<PrivateAssets>all</PrivateAssets>
7474
</PackageReference>
7575
</ItemGroup>

src/Autofac.Multitenant/MultitenantContainer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ public void ConfigureTenant(object tenantId, Action<ContainerBuilder> configurat
341341
/// Creates new tenant scope without any locking. Uses optimistic approach - creates the scope and in case it fails to insert to the dictionary it's immediately disposed.
342342
/// This should happen very rarely, hopefully never.
343343
/// </summary>
344+
[SuppressMessage("CA1513", "CA1513", Justification = "ObjectDisposedException.ThrowIf is not available in all target frameworks.")]
344345
private ILifetimeScope CreateTenantScope(object tenantId, Action<ContainerBuilder>? configuration = null)
345346
{
346347
if (_isDisposed == 1)
@@ -458,12 +459,11 @@ public ILifetimeScope GetTenantScope(object? tenantId)
458459
/// <summary>
459460
/// Returns collection of all registered tenants IDs.
460461
/// </summary>
461-
#pragma warning disable CA1024
462+
[SuppressMessage("CA1024", "CA1024", Justification = "Iterating the tenants allocates memory and locks the keys, so a method is appropriate to signify it's more than a fixed set of things.")]
462463
public IEnumerable<object> GetTenants()
463464
{
464465
return new List<object>(_tenantLifetimeScopes.Keys);
465466
}
466-
#pragma warning restore CA1024
467467

468468
/// <summary>
469469
/// Returns whether the given tenant ID has been configured.
@@ -524,7 +524,7 @@ public void ClearTenants()
524524
/// if the component registered requires another component be available
525525
/// but that required component is not available, this exception will be thrown.
526526
/// </exception>
527-
public object ResolveComponent(ResolveRequest request)
527+
public object ResolveComponent(in ResolveRequest request)
528528
{
529529
return GetCurrentTenantScope().ResolveComponent(request);
530530
}

test/Autofac.Multitenant.AspNetCore.Test/Autofac.Multitenant.AspNetCore.Test.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
44
<NoWarn>$(NoWarn);CS1591</NoWarn>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<AssemblyOriginatorKeyFile>../../Autofac.snk</AssemblyOriginatorKeyFile>
77
<SignAssembly>true</SignAssembly>
88
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
99
<CodeAnalysisRuleSet>../../build/Test.ruleset</CodeAnalysisRuleSet>
10+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1011
<IsPackable>false</IsPackable>
1112
<LangVersion>latest</LangVersion>
1213
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
13-
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1414
<ImplicitUsings>enable</ImplicitUsings>
1515
</PropertyGroup>
1616

@@ -28,7 +28,7 @@
2828
</ItemGroup>
2929

3030
<ItemGroup>
31-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
31+
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
3232
<PackageReference Include="coverlet.collector" Version="6.0.0">
3333
<PrivateAssets>all</PrivateAssets>
3434
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -37,14 +37,14 @@
3737
<PrivateAssets>all</PrivateAssets>
3838
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3939
</PackageReference>
40-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
41-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
42-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
40+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
41+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
42+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
4343
<PrivateAssets>all</PrivateAssets>
4444
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4545
</PackageReference>
46-
<PackageReference Include="xunit" Version="2.5.0" />
47-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
46+
<PackageReference Include="xunit" Version="2.6.6" />
47+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
4848
<PrivateAssets>all</PrivateAssets>
4949
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
5050
</PackageReference>

test/Autofac.Multitenant.Test/Autofac.Multitenant.Test.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-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
44
<NoWarn>$(NoWarn);CS1591</NoWarn>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<AssemblyOriginatorKeyFile>../../Autofac.snk</AssemblyOriginatorKeyFile>
@@ -36,13 +36,13 @@
3636
<PrivateAssets>all</PrivateAssets>
3737
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3838
</PackageReference>
39-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
40-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
39+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
40+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
4141
<PrivateAssets>all</PrivateAssets>
4242
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4343
</PackageReference>
44-
<PackageReference Include="xunit" Version="2.5.0" />
45-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
44+
<PackageReference Include="xunit" Version="2.6.6" />
45+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
4646
<PrivateAssets>all</PrivateAssets>
4747
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
4848
</PackageReference>

test/Autofac.Multitenant.Test/MultitenantContainerFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ public async Task MultitenantContainer_AsyncDispose()
755755
var mtc = new MultitenantContainer(strategy, new ContainerBuilder().Build());
756756
mtc.ConfigureTenant("tenant1", b => b.RegisterType<StubDependency1Impl1>().As<IStubDependency1>());
757757

758-
await mtc.DisposeAsync().ConfigureAwait(false);
758+
await mtc.DisposeAsync();
759759
}
760760

761761
[Fact]

0 commit comments

Comments
 (0)