diff --git a/.editorconfig b/.editorconfig
index 134e57859..57b2d5ae6 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,8 +1,5 @@
-; EditorConfig to support per-solution formatting.
-; Use the EditorConfig VS add-in to make this work.
-; http://editorconfig.org/
-
-; This is the default for the codeline.
+# EditorConfig to support per-solution formatting.
+# http://editorconfig.org/
root = true
[*]
@@ -10,13 +7,187 @@ indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
-; .NET Code - almost, but not exactly, the same suggestions as corefx
-; https://github.com/dotnet/corefx/blob/master/.editorconfig
+# .NET Code
[*.cs]
indent_size = 4
charset = utf-8-bom
-; New line preferences
+# .NET project files and MSBuild - match defaults for VS
+[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}]
+indent_size = 2
+
+# .NET solution files - match defaults for VS
+[*.sln]
+end_of_line = crlf
+indent_style = tab
+
+# .NET XML solution files - match dotnet new sln defaults
+[*.slnx]
+indent_size = 2
+
+
+# Config - match XML and default nuget.config template
+[*.config]
+indent_size = 2
+
+# Resources - match defaults for VS
+[*.resx]
+indent_size = 2
+
+# Static analysis rulesets - match defaults for VS
+[*.ruleset]
+indent_size = 2
+
+# HTML, XML - match defaults for VS
+[*.{cshtml,html,xml}]
+indent_size = 4
+
+# JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates
+[*.{js,json,mjs,ts,vue}]
+indent_size = 2
+
+# Markdown - match markdownlint settings
+[*.{md,markdown}]
+indent_size = 2
+
+# PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter
+[*.{ps1,psd1,psm1}]
+indent_size = 4
+charset = utf-8-bom
+
+# YAML - match standard YAML like Kubernetes and GitHub Actions
+[*.{yaml,yml}]
+indent_size = 2
+
+# ReStructuredText - standard indentation format from examples
+[*.rst]
+indent_size = 2
+
+#
+# dotnet code style
+#
+[*.cs]
+
+# Sort using and Import directives with System.* appearing first
+dotnet_sort_system_directives_first = true
+dotnet_separate_import_directive_groups = false
+
+# Avoid this. unless absolutely necessary
+dotnet_style_qualification_for_field = false:suggestion
+dotnet_style_qualification_for_property = false:suggestion
+dotnet_style_qualification_for_method = false:suggestion
+dotnet_style_qualification_for_event = false:suggestion
+
+# Use language keywords instead of framework type names for type references
+dotnet_style_predefined_type_for_locals_parameters_members = true:warning
+dotnet_style_predefined_type_for_member_access = true:warning
+
+# Suggest more modern language features when available
+dotnet_style_object_initializer = true:warning
+dotnet_style_collection_initializer = true:warning
+dotnet_style_coalesce_expression = true:warning
+dotnet_style_null_propagation = true:warning
+dotnet_style_explicit_tuple_names = true:warning
+
+# Whitespace options
+dotnet_style_allow_multiple_blank_lines_experimental = false
+
+# Non-private static fields are PascalCase
+dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = warning
+dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
+dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
+
+dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
+dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
+dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
+
+dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
+
+# Non-private readonly fields are PascalCase
+dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = warning
+dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
+dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
+
+dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
+dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
+dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
+
+dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
+
+# Constants are PascalCase
+dotnet_naming_rule.constants_should_be_pascal_case.severity = warning
+dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
+dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
+
+dotnet_naming_symbols.constants.applicable_kinds = field, local
+dotnet_naming_symbols.constants.required_modifiers = const
+
+dotnet_naming_style.constant_style.capitalization = pascal_case
+
+# Static fields should be _camelCase
+dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning
+dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
+dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style
+dotnet_naming_symbols.static_fields.applicable_kinds = field
+dotnet_naming_symbols.static_fields.required_modifiers = static
+
+dotnet_naming_style.static_field_style.capitalization = camel_case
+
+# Instance fields are camelCase and start with _
+dotnet_naming_rule.instance_fields_should_be_camel_case.severity = warning
+dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
+dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
+
+dotnet_naming_symbols.instance_fields.applicable_kinds = field
+
+dotnet_naming_style.instance_field_style.capitalization = camel_case
+dotnet_naming_style.instance_field_style.required_prefix = _
+
+# Locals and parameters are camelCase
+dotnet_naming_rule.locals_should_be_camel_case.severity = warning
+dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
+dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
+
+dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
+
+dotnet_naming_style.camel_case_style.capitalization = camel_case
+
+# Local functions are PascalCase
+dotnet_naming_rule.local_functions_should_be_pascal_case.severity = warning
+dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
+dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
+
+dotnet_naming_symbols.local_functions.applicable_kinds = local_function
+
+dotnet_naming_style.local_function_style.capitalization = pascal_case
+
+# By default, name items with PascalCase
+dotnet_naming_rule.members_should_be_pascal_case.severity = warning
+dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
+dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
+
+dotnet_naming_symbols.all_members.applicable_kinds = *
+
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+
+# IDE0035: Remove unreachable code
+dotnet_diagnostic.IDE0035.severity = warning
+
+# IDE0036: Order modifiers
+dotnet_diagnostic.IDE0036.severity = warning
+
+# IDE0043: Format string contains invalid placeholder
+dotnet_diagnostic.IDE0043.severity = warning
+
+# IDE0044: Make field readonly
+dotnet_diagnostic.IDE0044.severity = warning
+
+# IDE0055: Fix formatting
+dotnet_diagnostic.IDE0055.severity = warning
+
+# C# code style
+#
+# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
@@ -25,90 +196,34 @@ csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
-; Indentation preferences
+# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
-csharp_indent_labels = one_less_than_current
+csharp_indent_labels = flush_left
-; Modifier preferences
-csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning
-
-; Avoid this. unless absolutely necessary
-dotnet_style_qualification_for_field = false:suggestion
-dotnet_style_qualification_for_property = false:suggestion
-dotnet_style_qualification_for_method = false:suggestion
-dotnet_style_qualification_for_event = false:suggestion
+# Whitespace options
+# Each of the *_experimental rules has a corresponding IDE* setting.
+csharp_style_allow_embedded_statements_on_same_line_experimental = false
+dotnet_diagnostic.IDE2001.severity = warning
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
+dotnet_diagnostic.IDE2002.severity = warning
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
+dotnet_diagnostic.IDE2004.severity = warning
+csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
+dotnet_diagnostic.IDE2005.severity = warning
+csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
+dotnet_diagnostic.IDE2006.severity = warning
-; Types: use keywords instead of BCL types, using var is fine.
-csharp_style_var_when_type_is_apparent = false:none
-dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
-dotnet_style_predefined_type_for_member_access = true:suggestion
-
-; Name all constant fields using PascalCase
-dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning
-dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
-dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
-dotnet_naming_symbols.constant_fields.applicable_kinds = field
-dotnet_naming_symbols.constant_fields.required_modifiers = const
-dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+# Prefer "var" everywhere
+dotnet_diagnostic.IDE0007.severity = warning
+csharp_style_var_for_built_in_types = true:warning
+csharp_style_var_when_type_is_apparent = true:warning
+csharp_style_var_elsewhere = true:warning
-; Static fields should be _camelCase
-dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning
-dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
-dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style
-dotnet_naming_symbols.static_fields.applicable_kinds = field
-dotnet_naming_symbols.static_fields.required_modifiers = static
-dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
-
-; Static readonly fields should be PascalCase
-dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning
-dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields
-dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style
-dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
-dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
-dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = private, internal, private_protected
-
-; Internal and private fields should be _camelCase
-dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning
-dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
-dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
-dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
-dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
-dotnet_naming_style.camel_case_underscore_style.required_prefix = _
-dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
-
-; Code style defaults
-csharp_using_directive_placement = outside_namespace:suggestion
-dotnet_sort_system_directives_first = true
-csharp_prefer_braces = true:refactoring
-csharp_preserve_single_line_blocks = true:none
-csharp_preserve_single_line_statements = false:none
-csharp_prefer_static_local_function = true:suggestion
-csharp_prefer_simple_using_statement = false:none
-csharp_style_prefer_switch_expression = true:suggestion
-
-; Code quality
-dotnet_style_readonly_field = true:suggestion
-dotnet_code_quality_unused_parameters = non_public:suggestion
-
-; Expression-level preferences
-dotnet_style_object_initializer = true:suggestion
-dotnet_style_collection_initializer = true:suggestion
-dotnet_style_explicit_tuple_names = true:suggestion
-dotnet_style_coalesce_expression = true:suggestion
-dotnet_style_null_propagation = true:suggestion
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
-dotnet_style_prefer_inferred_tuple_names = true:suggestion
-dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
-dotnet_style_prefer_auto_properties = true:suggestion
-dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
-dotnet_style_prefer_conditional_expression_over_return = true:refactoring
-csharp_prefer_simple_default_expression = true:suggestion
-
-# Expression-bodied members
+# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = true:refactoring
csharp_style_expression_bodied_constructors = true:refactoring
csharp_style_expression_bodied_operators = true:refactoring
@@ -118,20 +233,15 @@ csharp_style_expression_bodied_accessors = true:refactoring
csharp_style_expression_bodied_lambdas = true:refactoring
csharp_style_expression_bodied_local_functions = true:refactoring
-# Pattern matching
-csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
-csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
-csharp_style_inlined_variable_declaration = true:suggestion
-
-# Null checking preferences
-csharp_style_throw_expression = true:suggestion
-csharp_style_conditional_delegate_call = true:suggestion
-
-# Other features
-csharp_style_namespace_declarations = file_scoped:suggestion
-csharp_style_prefer_index_operator = false:none
-csharp_style_prefer_range_operator = false:none
-csharp_style_pattern_local_over_anonymous_function = false:none
+# Suggest more modern language features when available
+csharp_style_pattern_matching_over_is_with_cast_check = true:warning
+csharp_style_pattern_matching_over_as_with_null_check = true:warning
+csharp_style_inlined_variable_declaration = true:warning
+csharp_style_throw_expression = true:warning
+csharp_style_conditional_delegate_call = true:warning
+csharp_style_prefer_extended_property_pattern = true:warning
+csharp_style_namespace_declarations = file_scoped:warning
+csharp_style_prefer_parameter_null_checking = false
# Space preferences
csharp_space_after_cast = false
@@ -157,48 +267,30 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
-; .NET project files and MSBuild - match defaults for VS
-[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}]
-indent_size = 2
+# Blocks required
+csharp_prefer_braces = true:warning
+csharp_preserve_single_line_blocks = false
+csharp_preserve_single_line_statements = false
-; .NET solution files - match defaults for VS
-[*.sln]
-end_of_line = crlf
-indent_style = tab
+# IDE0011: Add braces
+csharp_prefer_braces = when_multiline:warning
+# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
+dotnet_diagnostic.IDE0011.severity = warning
-; Config - match XML and default nuget.config template
-[*.config]
-indent_size = 2
+# IDE0040: Add accessibility modifiers
+dotnet_diagnostic.IDE0040.severity = warning
-; Resources - match defaults for VS
-[*.resx]
-indent_size = 2
+# IDE0052: Remove unread private member
+dotnet_diagnostic.IDE0052.severity = warning
-; Static analysis rulesets - match defaults for VS
-[*.ruleset]
-indent_size = 2
+# IDE0059: Unnecessary assignment to a value
+dotnet_diagnostic.IDE0059.severity = warning
-; HTML, XML - match defaults for VS
-[*.{cshtml,html,xml}]
-indent_size = 4
-
-; JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates
-[*.{js,json,ts,vue}]
-indent_size = 2
+# IDE0060: Remove unused parameter
+dotnet_diagnostic.IDE0060.severity = warning
-; Markdown - match markdownlint settings
-[*.{md,markdown}]
-indent_size = 2
+# CA1012: Abstract types should not have public constructors
+dotnet_diagnostic.CA1012.severity = warning
-; PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter
-[*.{ps1,psd1,psm1}]
-indent_size = 4
-charset = utf-8-bom
-
-; ReStructuredText - standard indentation format from examples
-[*.rst]
-indent_size = 2
-
-# YAML - match standard YAML like Kubernetes and GitHub Actions
-[*.{yaml,yml}]
-indent_size = 2
+# CA1822: Make member static
+dotnet_diagnostic.CA1822.severity = warning
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1bb960f05..806661866 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -8,13 +8,13 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/igorshubovych/markdownlint-cli
- rev: "76b3d32d3f4b965e1d6425253c59407420ae2c43" # frozen: v0.47.0
+ rev: "e72a3ca1632f0b11a07d171449fe447a7ff6795e" # frozen: v0.48.0
hooks:
- id: markdownlint
args:
- --fix
- repo: https://github.com/tillig/json-sort-cli
- rev: "009ab2ab49e1f2fa9d6b9dfc31009ceeca055204" # frozen: v3.0.0
+ rev: "2b7e147e0933bd30b58133b6f287e5c695ff4f0e" # frozen: v3.0.1
hooks:
- id: json-sort
args:
diff --git a/bench/Autofac.BenchmarkProfiling/Program.cs b/bench/Autofac.BenchmarkProfiling/Program.cs
index cd2025b6e..1bc529957 100644
--- a/bench/Autofac.BenchmarkProfiling/Program.cs
+++ b/bench/Autofac.BenchmarkProfiling/Program.cs
@@ -6,9 +6,9 @@ namespace Autofac.BenchmarkProfiling;
///
/// Simple command-line tool to invoke a benchmark manually in a way that helps with profiling each of the benchmarks.
///
-class Program
+internal class Program
{
- static void Main(string[] args)
+ private static void Main(string[] args)
{
// Pick a benchmark.
var availableBenchmarks = Benchmarks.BenchmarkSet.All;
@@ -84,7 +84,7 @@ static void Main(string[] args)
// Workload method is generated differently when BenchmarkDotNet actually runs; we'll need to wrap it in the set of parameters.
// It's way slower than they way they do it, but it should still give us good profiler results.
- void workloadAction(int repeat)
+ void WorkloadAction(int repeat)
{
while (repeat > 0)
{
@@ -96,13 +96,13 @@ void workloadAction(int repeat)
setupAction.InvokeSingle();
// Warmup.
- workloadAction(100);
+ WorkloadAction(100);
// Now start a new thread.
var runThread = new Thread(new ThreadStart(() =>
{
// Do a lot.
- workloadAction(10000);
+ WorkloadAction(10000);
}))
{
Name = "Workload Thread"
@@ -124,7 +124,7 @@ private static void PrintBenchmarks(Type[] availableBenchmarks)
private static void PrintCases(BenchmarkRunInfo benchRunInfo)
{
- for (int idx = 0; idx < benchRunInfo.BenchmarksCases.Length; idx++)
+ for (var idx = 0; idx < benchRunInfo.BenchmarksCases.Length; idx++)
{
var benchCase = benchRunInfo.BenchmarksCases[idx];
if (benchCase.HasParameters)
diff --git a/bench/Autofac.Benchmarks/ConcurrencyBenchmark.cs b/bench/Autofac.Benchmarks/ConcurrencyBenchmark.cs
index 50f18251d..c0e6bcaa7 100644
--- a/bench/Autofac.Benchmarks/ConcurrencyBenchmark.cs
+++ b/bench/Autofac.Benchmarks/ConcurrencyBenchmark.cs
@@ -24,10 +24,16 @@ public ConcurrencyBenchmark()
}
[Params(100 /*, 100, 1_000 */)]
- public int ResolveTaskCount { get; set; }
+ public int ResolveTaskCount
+ {
+ get; set;
+ }
[Params(100 /*, 1_000, 10_000 */)]
- public int ResolvesPerTask { get; set; }
+ public int ResolvesPerTask
+ {
+ get; set;
+ }
[Benchmark]
public async Task MultipleResolvesOnMultipleTasks()
@@ -40,11 +46,7 @@ public async Task MultipleResolvesOnMultipleTasks()
{
for (var j = 0; j < ResolvesPerTask; j++)
{
- var instance = _container.Resolve();
- if (instance is null)
- {
- throw new InvalidOperationException("Instance is null");
- }
+ var instance = _container.Resolve() ?? throw new InvalidOperationException("Instance is null");
}
});
tasks.Add(task);
diff --git a/bench/Autofac.Benchmarks/ConcurrencyNestedScopeBenchmark.cs b/bench/Autofac.Benchmarks/ConcurrencyNestedScopeBenchmark.cs
index b68ca9a87..4e72bdf30 100644
--- a/bench/Autofac.Benchmarks/ConcurrencyNestedScopeBenchmark.cs
+++ b/bench/Autofac.Benchmarks/ConcurrencyNestedScopeBenchmark.cs
@@ -22,10 +22,16 @@ public ConcurrencyNestedScopeBenchmark()
}
[Params(100 /*, 100, 1_000 */)]
- public int ConcurrentRequests { get; set; }
+ public int ConcurrentRequests
+ {
+ get; set;
+ }
[Params(10)]
- public int RepeatCount { get; set; }
+ public int RepeatCount
+ {
+ get; set;
+ }
[Benchmark]
public async Task MultipleResolvesOnMultipleTasks()
@@ -41,25 +47,13 @@ public async Task MultipleResolvesOnMultipleTasks()
// Start request
using (var requestScope = _container.BeginLifetimeScope("request"))
{
- var service1 = requestScope.Resolve();
- if (service1 == null)
- {
- throw new InvalidOperationException("Service1 is null");
- }
+ var service1 = requestScope.Resolve() ?? throw new InvalidOperationException("Service1 is null");
using (var unitOfWorkScope = requestScope.BeginLifetimeScope())
{
- var nestedRequestService2 = unitOfWorkScope.Resolve();
- if (nestedRequestService2 == null)
- {
- throw new InvalidOperationException("Nested request service is null");
- }
+ var nestedRequestService2 = unitOfWorkScope.Resolve() ?? throw new InvalidOperationException("Nested request service is null");
- var unitOfWork = unitOfWorkScope.Resolve();
- if (unitOfWork == null)
- {
- throw new InvalidOperationException("Unit of work is null");
- }
+ var unitOfWork = unitOfWorkScope.Resolve() ?? throw new InvalidOperationException("Unit of work is null");
}
}
}
diff --git a/bench/Autofac.Benchmarks/Program.cs b/bench/Autofac.Benchmarks/Program.cs
index 6e98befa4..47b502275 100644
--- a/bench/Autofac.Benchmarks/Program.cs
+++ b/bench/Autofac.Benchmarks/Program.cs
@@ -78,8 +78,8 @@ private static bool TryMatchBaselineArg(string arg, out string? valueFromAssignm
{
valueFromAssignment = null;
- static bool Matches(string candidate) =>
- candidate.Equals("--baseline-version", StringComparison.OrdinalIgnoreCase) ||
+ static bool Matches(string candidate)
+ => candidate.Equals("--baseline-version", StringComparison.OrdinalIgnoreCase) ||
candidate.Equals("--baselineVersion", StringComparison.OrdinalIgnoreCase);
var equalsIndex = arg.AsSpan().IndexOf('=');
diff --git a/bench/Autofac.Benchmarks/PropertyInjectionBenchmark.cs b/bench/Autofac.Benchmarks/PropertyInjectionBenchmark.cs
index a98c3ee3d..a6fa210b7 100644
--- a/bench/Autofac.Benchmarks/PropertyInjectionBenchmark.cs
+++ b/bench/Autofac.Benchmarks/PropertyInjectionBenchmark.cs
@@ -30,29 +30,47 @@ public void Resolve()
internal class A
{
- public B1? B1 { get; set; }
+ public B1? B1
+ {
+ get; set;
+ }
- public B2? B2 { get; set; }
+ public B2? B2
+ {
+ get; set;
+ }
}
internal class B1
{
- public C1? C1 { get; set; }
+ public C1? C1
+ {
+ get; set;
+ }
}
internal class B2
{
- public C2? C2 { get; set; }
+ public C2? C2
+ {
+ get; set;
+ }
}
internal class C1
{
- public D1? D1 { get; set; }
+ public D1? D1
+ {
+ get; set;
+ }
}
internal class C2
{
- public D2? D2 { get; set; }
+ public D2? D2
+ {
+ get; set;
+ }
}
internal class D1
diff --git a/bench/Autofac.Benchmarks/RequiredPropertyBenchmark.cs b/bench/Autofac.Benchmarks/RequiredPropertyBenchmark.cs
index a57544e67..667129535 100644
--- a/bench/Autofac.Benchmarks/RequiredPropertyBenchmark.cs
+++ b/bench/Autofac.Benchmarks/RequiredPropertyBenchmark.cs
@@ -48,15 +48,27 @@ public ConstructorComponent(ServiceA serviceA, ServiceB serviceB)
ServiceB = serviceB;
}
- public ServiceA ServiceA { get; }
+ public ServiceA ServiceA
+ {
+ get;
+ }
- public ServiceB ServiceB { get; }
+ public ServiceB ServiceB
+ {
+ get;
+ }
}
private class RequiredPropertyComponent
{
- public required ServiceA ServiceA { get; set; }
+ public required ServiceA ServiceA
+ {
+ get; set;
+ }
- public required ServiceA ServiceB { get; set; }
+ public required ServiceA ServiceB
+ {
+ get; set;
+ }
}
}
diff --git a/build/stylecop.json b/build/stylecop.json
index 8f5c703d0..20da2f6e6 100644
--- a/build/stylecop.json
+++ b/build/stylecop.json
@@ -9,6 +9,9 @@
"licenseName": "MIT"
},
"xmlHeader": false
+ },
+ "orderingRules": {
+ "usingDirectivesPlacement": "outsideNamespace"
}
}
}
diff --git a/codegen/Autofac.CodeGen/DelegateRegisterGenerator.cs b/codegen/Autofac.CodeGen/DelegateRegisterGenerator.cs
index c625ef909..9e118bec6 100644
--- a/codegen/Autofac.CodeGen/DelegateRegisterGenerator.cs
+++ b/codegen/Autofac.CodeGen/DelegateRegisterGenerator.cs
@@ -26,7 +26,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
{
// Set up an incremental generator that regenerates when the 'RegistrationExtensions' class changes.
// Capture the INamedTypeSymbol when it does.
- IncrementalValuesProvider classDeclarations = context.SyntaxProvider
+ var classDeclarations = context.SyntaxProvider
.CreateSyntaxProvider(
predicate: static (s, _) => s is ClassDeclarationSyntax classSyn && classSyn.Modifiers.Any(static m => m.IsKind(SyntaxKind.PartialKeyword)),
transform: static (context, cancelToken) =>
@@ -47,7 +47,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
.Where(static m => m is not null)!;
// Just get our first one (will only be one instance anyway, we just need to convert to a single value provider).
- IncrementalValueProvider firstSyntax
+ var firstSyntax
= classDeclarations.Collect().Select((all, _) => all.FirstOrDefault());
context.RegisterSourceOutput(
@@ -74,9 +74,9 @@ private static void Execute(SourceProductionContext spc, INamedTypeSymbol? regEx
spc,
"RegistrationExtensions",
"Register",
- static (int argCount, bool hasComponentContext) => hasComponentContext ?
- $"DelegateInvokers.DelegateInvoker{argCount}WithComponentContext" :
- $"DelegateInvokers.DelegateInvoker{argCount}",
+ static (int argCount, bool hasComponentContext) => hasComponentContext
+ ? $"DelegateInvokers.DelegateInvoker{argCount}WithComponentContext"
+ : $"DelegateInvokers.DelegateInvoker{argCount}",
NumberOfGenericArgs);
}
diff --git a/default.proj b/default.proj
index 49be97cd7..3eea4279a 100644
--- a/default.proj
+++ b/default.proj
@@ -63,8 +63,8 @@
-
-
+
+
diff --git a/src/Autofac/Builder/BuildCallbackManager.cs b/src/Autofac/Builder/BuildCallbackManager.cs
index ebe69af35..a825dbc88 100644
--- a/src/Autofac/Builder/BuildCallbackManager.cs
+++ b/src/Autofac/Builder/BuildCallbackManager.cs
@@ -12,7 +12,7 @@ internal static class BuildCallbackManager
{
private const string BuildCallbacksExecutedKey = nameof(BuildCallbacksExecutedKey);
- private static readonly TypedService CallbackServiceType = new(typeof(BuildCallbackService));
+ private static readonly TypedService _callbackServiceType = new(typeof(BuildCallbackService));
///
/// Executes the newly-registered build callbacks for a given scope/container..
@@ -20,7 +20,7 @@ internal static class BuildCallbackManager
/// The new scope/container.
internal static void RunBuildCallbacks(ILifetimeScope scope)
{
- var buildCallbackServices = scope.ComponentRegistry.ServiceRegistrationsFor(CallbackServiceType);
+ var buildCallbackServices = scope.ComponentRegistry.ServiceRegistrationsFor(_callbackServiceType);
foreach (var srv in buildCallbackServices)
{
@@ -30,7 +30,7 @@ internal static void RunBuildCallbacks(ILifetimeScope scope)
continue;
}
- var request = new ResolveRequest(CallbackServiceType, srv, Enumerable.Empty());
+ var request = new ResolveRequest(_callbackServiceType, srv, Enumerable.Empty());
var component = (BuildCallbackService)scope.ResolveComponent(request);
srv.Registration.Metadata[BuildCallbacksExecutedKey] = true;
diff --git a/src/Autofac/Builder/DeferredCallback.cs b/src/Autofac/Builder/DeferredCallback.cs
index ac6045a3a..4febda75b 100644
--- a/src/Autofac/Builder/DeferredCallback.cs
+++ b/src/Autofac/Builder/DeferredCallback.cs
@@ -59,5 +59,8 @@ public Action Callback
/// A that uniquely identifies the callback action
/// in a set of callbacks.
///
- public Guid Id { get; }
+ public Guid Id
+ {
+ get;
+ }
}
diff --git a/src/Autofac/Builder/IConcreteActivatorData.cs b/src/Autofac/Builder/IConcreteActivatorData.cs
index 9c5aeb3fb..0c71a3662 100644
--- a/src/Autofac/Builder/IConcreteActivatorData.cs
+++ b/src/Autofac/Builder/IConcreteActivatorData.cs
@@ -13,5 +13,8 @@ public interface IConcreteActivatorData
///
/// Gets the instance activator based on the provided data.
///
- IInstanceActivator Activator { get; }
+ IInstanceActivator Activator
+ {
+ get;
+ }
}
diff --git a/src/Autofac/Builder/IRegistrationBuilder.cs b/src/Autofac/Builder/IRegistrationBuilder.cs
index f76e252d0..cdcd0cbca 100644
--- a/src/Autofac/Builder/IRegistrationBuilder.cs
+++ b/src/Autofac/Builder/IRegistrationBuilder.cs
@@ -19,25 +19,37 @@ public interface IRegistrationBuilder
[EditorBrowsable(EditorBrowsableState.Never)]
- RegistrationData RegistrationData { get; }
+ RegistrationData RegistrationData
+ {
+ get;
+ }
///
/// Gets the activator data.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- TActivatorData ActivatorData { get; }
+ TActivatorData ActivatorData
+ {
+ get;
+ }
///
/// Gets the registration style.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- TRegistrationStyle RegistrationStyle { get; }
+ TRegistrationStyle RegistrationStyle
+ {
+ get;
+ }
///
/// Gets the resolve pipeline for this registration.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- IResolvePipelineBuilder ResolvePipeline { get; }
+ IResolvePipelineBuilder ResolvePipeline
+ {
+ get;
+ }
///
/// Configure the component so that instances are never disposed by the container.
diff --git a/src/Autofac/Builder/ReflectionActivatorData.cs b/src/Autofac/Builder/ReflectionActivatorData.cs
index c82a67a3c..01b30d127 100644
--- a/src/Autofac/Builder/ReflectionActivatorData.cs
+++ b/src/Autofac/Builder/ReflectionActivatorData.cs
@@ -11,8 +11,8 @@ namespace Autofac.Builder;
///
public class ReflectionActivatorData
{
- private static readonly IConstructorFinder DefaultConstructorFinder = new DefaultConstructorFinder();
- private static readonly IConstructorSelector DefaultConstructorSelector = new MostParametersConstructorSelector();
+ private static readonly IConstructorFinder _defaultConstructorFinder = new DefaultConstructorFinder();
+ private static readonly IConstructorSelector _defaultConstructorSelector = new MostParametersConstructorSelector();
private Type _implementer = default!;
private IConstructorFinder _constructorFinder;
@@ -26,8 +26,8 @@ public ReflectionActivatorData(Type implementer)
{
ImplementationType = implementer;
- _constructorFinder = DefaultConstructorFinder;
- _constructorSelector = DefaultConstructorSelector;
+ _constructorFinder = _defaultConstructorFinder;
+ _constructorSelector = _defaultConstructorSelector;
}
///
diff --git a/src/Autofac/Builder/RegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.cs b/src/Autofac/Builder/RegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.cs
index 6cd15735e..2b243ffc6 100644
--- a/src/Autofac/Builder/RegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.cs
+++ b/src/Autofac/Builder/RegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.cs
@@ -54,25 +54,37 @@ public RegistrationBuilder(Service defaultService, TActivatorData activatorData,
/// Gets the activator data.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- public TActivatorData ActivatorData { get; }
+ public TActivatorData ActivatorData
+ {
+ get;
+ }
///
/// Gets the registration style.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- public TRegistrationStyle RegistrationStyle { get; }
+ public TRegistrationStyle RegistrationStyle
+ {
+ get;
+ }
///
/// Gets the registration data.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- public RegistrationData RegistrationData { get; }
+ public RegistrationData RegistrationData
+ {
+ get;
+ }
///
/// Gets the resolve pipeline builder, that can be used to add middleware to the pipeline.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- public IResolvePipelineBuilder ResolvePipeline { get; }
+ public IResolvePipelineBuilder ResolvePipeline
+ {
+ get;
+ }
///
/// Configure the component so that instances are never disposed by the container.
@@ -272,8 +284,8 @@ public IRegistrationBuilder As As(params Type[] services)
{
// Issue #919: Use arrays and iteration rather than LINQ to reduce memory allocation.
- Service[] argArray = new Service[services.Length];
- for (int i = 0; i < services.Length; i++)
+ var argArray = new Service[services.Length];
+ for (var i = 0; i < services.Length; i++)
{
var service = services[i];
if (service.FullName is not null)
diff --git a/src/Autofac/Builder/RegistrationData.cs b/src/Autofac/Builder/RegistrationData.cs
index a732ee0c5..2b4362de8 100644
--- a/src/Autofac/Builder/RegistrationData.cs
+++ b/src/Autofac/Builder/RegistrationData.cs
@@ -82,12 +82,18 @@ public IComponentLifetime Lifetime
///
/// Gets the extended properties assigned to the component.
///
- public IDictionary Metadata { get; }
+ public IDictionary Metadata
+ {
+ get;
+ }
///
/// Gets or sets the options for the registration.
///
- public RegistrationOptions Options { get; set; }
+ public RegistrationOptions Options
+ {
+ get; set;
+ }
///
/// Gets or sets the callback used to register this component.
@@ -96,7 +102,10 @@ public IComponentLifetime Lifetime
/// A that contains the delegate
/// used to register this component with an .
///
- public DeferredCallback? DeferredCallback { get; set; }
+ public DeferredCallback? DeferredCallback
+ {
+ get; set;
+ }
///
/// Add multiple services for the registration, overriding the default.
diff --git a/src/Autofac/Builder/RegistrationOrderExtensions.cs b/src/Autofac/Builder/RegistrationOrderExtensions.cs
index 6d84daed5..14734ea84 100644
--- a/src/Autofac/Builder/RegistrationOrderExtensions.cs
+++ b/src/Autofac/Builder/RegistrationOrderExtensions.cs
@@ -17,7 +17,7 @@ internal static class RegistrationOrderExtensions
/// The original registration order value.
internal static long GetRegistrationOrder(this IComponentRegistration registration)
{
- return registration.Metadata.TryGetValue(MetadataKeys.RegistrationOrderMetadataKey, out object? value) ? (long)value! : long.MaxValue;
+ return registration.Metadata.TryGetValue(MetadataKeys.RegistrationOrderMetadataKey, out var value) ? (long)value! : long.MaxValue;
}
///
diff --git a/src/Autofac/Builder/SimpleActivatorData.cs b/src/Autofac/Builder/SimpleActivatorData.cs
index b18609449..336a02126 100644
--- a/src/Autofac/Builder/SimpleActivatorData.cs
+++ b/src/Autofac/Builder/SimpleActivatorData.cs
@@ -22,5 +22,8 @@ public SimpleActivatorData(IInstanceActivator activator)
///
/// Gets the activator.
///
- public IInstanceActivator Activator { get; }
+ public IInstanceActivator Activator
+ {
+ get;
+ }
}
diff --git a/src/Autofac/Builder/SingleRegistrationStyle.cs b/src/Autofac/Builder/SingleRegistrationStyle.cs
index 1463e1196..97838495e 100644
--- a/src/Autofac/Builder/SingleRegistrationStyle.cs
+++ b/src/Autofac/Builder/SingleRegistrationStyle.cs
@@ -25,10 +25,16 @@ public class SingleRegistrationStyle
/// By default, new registrations override existing registrations as defaults.
/// If set to true, new registrations will not change existing defaults.
///
- public bool PreserveDefaults { get; set; }
+ public bool PreserveDefaults
+ {
+ get; set;
+ }
///
/// Gets or sets the component upon which this registration is based.
///
- public IComponentRegistration? Target { get; set; }
+ public IComponentRegistration? Target
+ {
+ get; set;
+ }
}
diff --git a/src/Autofac/ContainerBuilder.cs b/src/Autofac/ContainerBuilder.cs
index f50340a06..2de6894bd 100644
--- a/src/Autofac/ContainerBuilder.cs
+++ b/src/Autofac/ContainerBuilder.cs
@@ -90,7 +90,10 @@ internal ContainerBuilder(IDictionary properties, IComponentReg
///
/// Gets the builder to use for building the underlying .
///
- public IComponentRegistryBuilder ComponentRegistryBuilder { get; }
+ public IComponentRegistryBuilder ComponentRegistryBuilder
+ {
+ get;
+ }
///
/// Gets the set of properties used during component registration.
@@ -99,7 +102,10 @@ internal ContainerBuilder(IDictionary properties, IComponentReg
/// An that can be used to share
/// context across registrations.
///
- public IDictionary Properties { get; }
+ public IDictionary Properties
+ {
+ get;
+ }
///
/// Register a callback that will be invoked when the container is configured.
diff --git a/src/Autofac/Core/ActivatedEventArgs.cs b/src/Autofac/Core/ActivatedEventArgs.cs
index 65b365ff3..6cd0cee7f 100644
--- a/src/Autofac/Core/ActivatedEventArgs.cs
+++ b/src/Autofac/Core/ActivatedEventArgs.cs
@@ -34,25 +34,40 @@ public ActivatedEventArgs(
///
/// Gets the service being resolved.
///
- public Service Service { get; }
+ public Service Service
+ {
+ get;
+ }
///
/// Gets the context in which the activation occurred.
///
- public IComponentContext Context { get; }
+ public IComponentContext Context
+ {
+ get;
+ }
///
/// Gets the component providing the instance.
///
- public IComponentRegistration Component { get; }
+ public IComponentRegistration Component
+ {
+ get;
+ }
///
/// Gets the parameters provided when resolved.
///
- public IEnumerable Parameters { get; }
+ public IEnumerable Parameters
+ {
+ get;
+ }
///
/// Gets the instance that will be used to satisfy the request.
///
- public T Instance { get; }
+ public T Instance
+ {
+ get;
+ }
}
diff --git a/src/Autofac/Core/ActivatingEventArgs.cs b/src/Autofac/Core/ActivatingEventArgs.cs
index cab6cf411..62b1c2cfe 100644
--- a/src/Autofac/Core/ActivatingEventArgs.cs
+++ b/src/Autofac/Core/ActivatingEventArgs.cs
@@ -33,17 +33,26 @@ public ActivatingEventArgs(IComponentContext context, Service service, IComponen
///
/// Gets the service being resolved.
///
- public Service Service { get; }
+ public Service Service
+ {
+ get;
+ }
///
/// Gets the context in which the activation occurred.
///
- public IComponentContext Context { get; }
+ public IComponentContext Context
+ {
+ get;
+ }
///
/// Gets the component providing the instance.
///
- public IComponentRegistration Component { get; }
+ public IComponentRegistration Component
+ {
+ get;
+ }
///
/// Gets or sets the instance that will be used to satisfy the request.
@@ -72,7 +81,10 @@ public T Instance
///
/// Gets the parameters supplied to the activator.
///
- public IEnumerable Parameters { get; }
+ public IEnumerable Parameters
+ {
+ get;
+ }
///
/// The instance can be replaced if needed, e.g. by an interface proxy.
diff --git a/src/Autofac/Core/Activators/DefaultPropertySelector.cs b/src/Autofac/Core/Activators/DefaultPropertySelector.cs
index 21fb65837..48ada16ca 100644
--- a/src/Autofac/Core/Activators/DefaultPropertySelector.cs
+++ b/src/Autofac/Core/Activators/DefaultPropertySelector.cs
@@ -25,7 +25,10 @@ public class DefaultPropertySelector : IPropertySelector
/// Gets a value indicating whether the value should be set if the value is already
/// set (ie non-null).
///
- public bool PreserveSetValues { get; }
+ public bool PreserveSetValues
+ {
+ get;
+ }
///
/// Gets an instance of DefaultPropertySelector that will cause values to be overwritten.
diff --git a/src/Autofac/Core/Activators/InstanceActivator.cs b/src/Autofac/Core/Activators/InstanceActivator.cs
index 62f9b7d93..25257db78 100644
--- a/src/Autofac/Core/Activators/InstanceActivator.cs
+++ b/src/Autofac/Core/Activators/InstanceActivator.cs
@@ -23,7 +23,10 @@ protected InstanceActivator(Type limitType)
///
/// Gets the most specific type that the component instances are known to be castable to.
///
- public Type LimitType { get; }
+ public Type LimitType
+ {
+ get;
+ }
///
/// Gets a string representation of the activator.
diff --git a/src/Autofac/Core/Activators/ProvidedInstance/ProvidedInstanceActivator.cs b/src/Autofac/Core/Activators/ProvidedInstance/ProvidedInstanceActivator.cs
index 22796689c..d02460444 100644
--- a/src/Autofac/Core/Activators/ProvidedInstance/ProvidedInstanceActivator.cs
+++ b/src/Autofac/Core/Activators/ProvidedInstance/ProvidedInstanceActivator.cs
@@ -31,7 +31,10 @@ public ProvidedInstanceActivator(object instance)
/// Necessary because otherwise instances that are never resolved will never be
/// disposed.
///
- public bool DisposeInstance { get; set; }
+ public bool DisposeInstance
+ {
+ get; set;
+ }
///
public void ConfigurePipeline(IComponentRegistryServices componentRegistryServices, IResolvePipelineBuilder pipelineBuilder)
diff --git a/src/Autofac/Core/Activators/Reflection/AutowiringPropertyInjector.cs b/src/Autofac/Core/Activators/Reflection/AutowiringPropertyInjector.cs
index 1ec6e3ff9..7efbb462b 100644
--- a/src/Autofac/Core/Activators/Reflection/AutowiringPropertyInjector.cs
+++ b/src/Autofac/Core/Activators/Reflection/AutowiringPropertyInjector.cs
@@ -17,7 +17,7 @@ internal static class AutowiringPropertyInjector
///
internal const string InstanceTypeNamedParameter = "Autofac.AutowiringPropertyInjector.InstanceType";
- private static readonly MethodInfo CallPropertySetterOpenGenericMethod =
+ private static readonly MethodInfo _callPropertySetterOpenGenericMethod =
typeof(AutowiringPropertyInjector).GetDeclaredMethod(nameof(CallPropertySetter));
///
@@ -164,13 +164,13 @@ private static IEnumerable GetInjectableProperties(Type instanceTy
// Create a delegate TDeclaringType -> { TDeclaringType.Property = TValue; }
var propertySetterAsAction = setMethod.CreateDelegate(typeof(Action<,>).MakeGenericType(typeInput, parameterType));
- var callPropertySetterClosedGenericMethod = CallPropertySetterOpenGenericMethod.MakeGenericMethod(typeInput, parameterType);
+ var callPropertySetterClosedGenericMethod = _callPropertySetterOpenGenericMethod.MakeGenericMethod(typeInput, parameterType);
var callPropertySetterDelegate = callPropertySetterClosedGenericMethod.CreateDelegate>(propertySetterAsAction);
return callPropertySetterDelegate;
}
private static void CallPropertySetter(
- Action setter, object target, object value) =>
- setter((TDeclaringType)target, (TValue)value);
+ Action setter, object target, object value)
+ => setter((TDeclaringType)target, (TValue)value);
}
diff --git a/src/Autofac/Core/Activators/Reflection/BoundConstructor.cs b/src/Autofac/Core/Activators/Reflection/BoundConstructor.cs
index 139c296de..4bd4f17ff 100644
--- a/src/Autofac/Core/Activators/Reflection/BoundConstructor.cs
+++ b/src/Autofac/Core/Activators/Reflection/BoundConstructor.cs
@@ -51,7 +51,10 @@ internal BoundConstructor(ConstructorBinder binder, ParameterInfo firstNonBindab
///
/// Gets the binder that created this binding.
///
- public ConstructorBinder Binder { get; }
+ public ConstructorBinder Binder
+ {
+ get;
+ }
///
/// Gets a value indicating whether the constructor has the SetsRequiredMembers attribute,
@@ -73,7 +76,10 @@ internal BoundConstructor(ConstructorBinder binder, ParameterInfo firstNonBindab
///
/// Gets a value indicating whether the binding is valid.
///
- public bool CanInstantiate { get; }
+ public bool CanInstantiate
+ {
+ get;
+ }
///
/// Gets a description of the constructor parameter binding.
@@ -99,8 +105,8 @@ public static BoundConstructor ForBindSuccess(ConstructorBinder binder, FuncThe binder that generated this binding.
/// The first parameter that prevented binding.
/// A with details about the unsuccessful bind.
- public static BoundConstructor ForBindFailure(ConstructorBinder binder, ParameterInfo firstNonBindableParameter) =>
- new(binder, firstNonBindableParameter);
+ public static BoundConstructor ForBindFailure(ConstructorBinder binder, ParameterInfo firstNonBindableParameter)
+ => new(binder, firstNonBindableParameter);
///
/// Invoke the constructor with the parameter bindings.
diff --git a/src/Autofac/Core/Activators/Reflection/ConstructorBinder.cs b/src/Autofac/Core/Activators/Reflection/ConstructorBinder.cs
index bb1fbab0c..0c0cdc0ab 100644
--- a/src/Autofac/Core/Activators/Reflection/ConstructorBinder.cs
+++ b/src/Autofac/Core/Activators/Reflection/ConstructorBinder.cs
@@ -13,7 +13,7 @@ namespace Autofac.Core.Activators.Reflection;
///
public class ConstructorBinder
{
- private static readonly Func> FactoryBuilder = GetConstructorInvoker;
+ private static readonly Func> _factoryBuilder = GetConstructorInvoker;
private readonly ParameterInfo[] _constructorArgs;
private readonly Func