diff --git a/.vscode/settings.json b/.vscode/settings.json index ce3b549..f7754b1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "cSpell.words": [ - "Xunit" + "autofac", + "xunit" ], "omnisharp.enableEditorConfigSupport": true } diff --git a/default.proj b/default.proj index f4bce04..9520d9a 100644 --- a/default.proj +++ b/default.proj @@ -2,7 +2,7 @@ - 6.1.2 + 7.0.0 Autofac.Extras.AggregateService Release $([System.IO.Path]::Combine($(MSBuildProjectDirectory),"artifacts")) diff --git a/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj b/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj index 23acaa5..c924c8f 100644 --- a/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj +++ b/src/Autofac.Extras.AggregateService/Autofac.Extras.AggregateService.csproj @@ -1,7 +1,7 @@  Dynamic aggregate service implementation generation for Autofac. - netstandard2.0;netstandard2.1 + net10.0;net8.0;netstandard2.1;netstandard2.0 latest enable true @@ -40,19 +40,12 @@ - - - - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - + + + All - + all diff --git a/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs b/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs index a769f95..a2e42e3 100644 --- a/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs +++ b/src/Autofac.Extras.AggregateService/ResolvingInterceptor.cs @@ -64,7 +64,7 @@ public void Intercept(IInvocation invocation) } return method - .DeclaringType + .DeclaringType? .GetProperties() .Where(prop => prop.GetGetMethod() == method) .FirstOrDefault(); @@ -159,7 +159,8 @@ private Dictionary> SetupInvocationMap(Type inte } // Methods without parameters - var methodWithoutParams = GetType().GetMethod("MethodWithoutParams", BindingFlags.Instance | BindingFlags.NonPublic); + var methodWithoutParams = GetType().GetMethod(nameof(MethodWithoutParams), BindingFlags.Instance | BindingFlags.NonPublic) + ?? throw new InvalidOperationException($"Unable to locate the {nameof(MethodWithoutParams)} method via reflection."); var methodWithoutParamsDelegate = (Action)methodWithoutParams.CreateDelegate(typeof(Action), this); methodMap.Add(method, methodWithoutParamsDelegate); }