From c4642d1982ca1d8d902bc142e5eae07eae9d1e7f Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Thu, 28 May 2026 12:35:43 -0700 Subject: [PATCH 1/9] Add SonarAnalyzer.CSharp and unified analyzer rulesets. Adds SonarAnalyzer.CSharp 10.27.0.140913 to all projects. Replaces existing Source.ruleset and Test.ruleset with unified versions shared across the Autofac organization. Ensures all projects have AnalysisMode=AllEnabledByDefault and EnforceCodeStyleInBuild=true. --- build/Source.ruleset | 42 +++++-- build/Test.ruleset | 103 +++++++++++++----- .../Autofac.Extras.AggregateService.csproj | 5 + ...utofac.Extras.AggregateService.Test.csproj | 6 + 4 files changed, 115 insertions(+), 41 deletions(-) diff --git a/build/Source.ruleset b/build/Source.ruleset index 459e4e0..b1e5bb6 100644 --- a/build/Source.ruleset +++ b/build/Source.ruleset @@ -1,8 +1,8 @@ - - + + - - + + @@ -12,23 +12,41 @@ - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + diff --git a/build/Test.ruleset b/build/Test.ruleset index 3c26c01..9434578 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -1,16 +1,12 @@ - - + + - - - - + + - - - + - + @@ -20,37 +16,79 @@ - - - + - + - - - + - + - + - + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -58,11 +96,11 @@ - + - + - + @@ -82,6 +120,13 @@ + + + + + + + diff --git a/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj b/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj index c924c8f..3b69d47 100644 --- a/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj +++ b/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj @@ -20,6 +20,7 @@ en-US Copyright (c) Autofac Project. All rights reserved. AllEnabledByDefault + true ../../build/Source.ruleset true true @@ -48,6 +49,10 @@ all + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj b/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj index fa145d0..a78792e 100644 --- a/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj +++ b/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj @@ -8,6 +8,8 @@ true true ../../build/Test.ruleset + AllEnabledByDefault + true false latest @@ -33,6 +35,10 @@ all + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all From 9cdab58ae45379f5d94d117632484f6621ef7edc Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Thu, 28 May 2026 14:44:05 -0700 Subject: [PATCH 2/9] Disable CA1034 in Test.ruleset: nested types are standard in test fixtures. --- build/Test.ruleset | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/Test.ruleset b/build/Test.ruleset index 9434578..742a68c 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -42,6 +42,8 @@ + + From 4f051a5a5557854965508d61708d6a456b1353fc Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Thu, 28 May 2026 14:46:04 -0700 Subject: [PATCH 3/9] Fix S2971: simplify LINQ by moving predicate into FirstOrDefault. --- src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs b/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs index a2e42e3..a24e13b 100644 --- a/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs +++ b/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs @@ -66,8 +66,7 @@ public void Intercept(IInvocation invocation) return method .DeclaringType? .GetProperties() - .Where(prop => prop.GetGetMethod() == method) - .FirstOrDefault(); + .FirstOrDefault(prop => prop.GetGetMethod() == method); } private static void InvalidReturnTypeInvocation(IInvocation invocation) From a7b0d4c7387ee9483a8aed98fb2ef2c766e08dd3 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Thu, 28 May 2026 17:45:11 -0700 Subject: [PATCH 4/9] Disable S1133: do not warn on use of obsolete/deprecated members. Autofac intentionally maintains deprecated APIs for backward compatibility. Tests exercise deprecated APIs to verify they still work. Warnings about using deprecated code are not actionable in this context. --- build/Source.ruleset | 2 ++ build/Test.ruleset | 2 ++ 2 files changed, 4 insertions(+) diff --git a/build/Source.ruleset b/build/Source.ruleset index b1e5bb6..1cd02ff 100644 --- a/build/Source.ruleset +++ b/build/Source.ruleset @@ -32,6 +32,8 @@ + + diff --git a/build/Test.ruleset b/build/Test.ruleset index 742a68c..7729333 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -55,6 +55,8 @@ + + From 994aa5fd125bf048c77a1f83ed7e27d9258e360f Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Fri, 29 May 2026 07:19:04 -0700 Subject: [PATCH 5/9] Enable CA1063, disable S3881, fix ruleset comment ordering. - CA1063 (Implement IDisposable correctly): enabled as Warning in both Source and Test rulesets for explicit enforcement. - S3881 (IDisposable pattern): disabled because Autofac uses non-standard dispose patterns for container lifecycle management. - Fixed comment/rule ordering where S1133 insertion displaced comments. --- build/Source.ruleset | 4 ++++ build/Test.ruleset | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build/Source.ruleset b/build/Source.ruleset index 1cd02ff..8994858 100644 --- a/build/Source.ruleset +++ b/build/Source.ruleset @@ -4,6 +4,8 @@ + + @@ -44,6 +46,8 @@ + + diff --git a/build/Test.ruleset b/build/Test.ruleset index 7729333..cd29cf9 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -6,6 +6,8 @@ + + @@ -54,9 +56,9 @@ - + @@ -80,6 +82,8 @@ + + From 39eb6b38d68bc9cc7198bec814a28c2f28181161 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Fri, 29 May 2026 10:38:53 -0700 Subject: [PATCH 6/9] Disable CA2201 in Test.ruleset: tests use generic exceptions for simulation. --- build/Test.ruleset | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/Test.ruleset b/build/Test.ruleset index cd29cf9..8559de5 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -39,6 +39,8 @@ + + From 2be5fd7387f32bd8f126883a7056a786d1a09a75 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Fri, 29 May 2026 12:58:14 -0700 Subject: [PATCH 7/9] Disable CA1711, CA1721, S125 in Test.ruleset. - CA1711: test classes commonly use suffixes like Impl, Handler, etc. - CA1721: test interfaces intentionally have properties matching methods. - S125: commented-out code in tests is acceptable for examples/notes. --- build/Test.ruleset | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/Test.ruleset b/build/Test.ruleset index 8559de5..b64a37a 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -23,6 +23,10 @@ + + + + @@ -55,6 +59,8 @@ + + From 4aae3178de6f660207074797c30564f2d8b7a6d4 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Fri, 29 May 2026 13:18:21 -0700 Subject: [PATCH 8/9] Fix CS1503: use named parameter to disambiguate ArgumentException overload. SDK 10.0.300 introduced overload ambiguity between ArgumentException(string, string) and ArgumentException(string, Exception?) when the message comes from a generated resource that returns string?. Using paramName: resolves the ambiguity. --- .../AggregateServiceGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Autofac.Extras.AggregateService/AggregateServiceGenerator.cs b/src/Autofac.Extras.AggregateService/AggregateServiceGenerator.cs index 1caa0a8..c64e6fd 100644 --- a/src/Autofac.Extras.AggregateService/AggregateServiceGenerator.cs +++ b/src/Autofac.Extras.AggregateService/AggregateServiceGenerator.cs @@ -47,7 +47,7 @@ public static object CreateInstance(Type interfaceType, IComponentContext contex if (!interfaceType.GetTypeInfo().IsInterface) { - throw new ArgumentException(AggregateServicesResources.TypeMustBeInterface, nameof(interfaceType)); + throw new ArgumentException(AggregateServicesResources.TypeMustBeInterface, paramName: nameof(interfaceType)); } var resolverInterceptor = new ResolvingInterceptor(interfaceType, context); From 2be0238b4e029da7108e98277f130597a1f2b0f2 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Fri, 29 May 2026 13:49:29 -0700 Subject: [PATCH 9/9] Update project metadata for more recent builds. --- .../Autofac.Extras.AggregateService.csproj | 50 ++++++++++++------- ...utofac.Extras.AggregateService.Test.csproj | 10 +--- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj b/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj index 3b69d47..8d25858 100644 --- a/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj +++ b/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj @@ -1,34 +1,43 @@  + + Autofac.Extras.AggregateService + Autofac.Extras.AggregateService Dynamic aggregate service implementation generation for Autofac. + Copyright © 2015 Autofac Contributors + Autofac Contributors + Autofac + Autofac + ../../Autofac.snk + true + en-US + net10.0;net8.0;netstandard2.1;netstandard2.0 latest enable - true true - Autofac.Extras.AggregateService - ../../Autofac.snk - true + ../../build/Source.ruleset + true + AllEnabledByDefault + enable + true + Autofac.Extras.AggregateService autofac;di;ioc;dependencyinjection Release notes are at https://github.com/autofac/Autofac.Extras.AggregateService/releases icon.png https://autofac.org MIT + README.md git https://github.com/autofac/Autofac.Extras.AggregateService - en-US - Copyright (c) Autofac Project. All rights reserved. - AllEnabledByDefault - true - ../../build/Source.ruleset true true true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - Autofac Contributors - Autofac - Autofac + true + snupkg + + PrepareResources;$(CompileDependsOn) @@ -36,6 +45,7 @@ + @@ -54,15 +64,17 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + + MSBuild:Compile + CSharp + $(IntermediateOutputPath)%(Filename).Designer.cs + %(Filename) + + - - ResXFileCodeGenerator - AggregateServicesResources.Designer.cs - $(IntermediateOutputPath)/AggregateServicesResources.Designer.cs - CSharp Autofac.Extras.AggregateService - AggregateServicesResources diff --git a/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj b/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj index a78792e..d4e04de 100644 --- a/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj +++ b/test/Autofac.Extras.AggregateService.Test/Autofac.Extras.AggregateService.Test.csproj @@ -15,14 +15,8 @@ - - - - - - - - + +