dotnetcore/AspectCore-Framework

AspectCore throw NullReferenceException in .net 6.0

l1honghui opened this issue · 1 comments

image

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=System.Private.CoreLib
StackTrace:
在 System.Reflection.Emit.SignatureHelper.AddOneArgTypeHelper(Type clsArgument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
在 System.Reflection.Emit.SignatureHelper.AddArgument(Type argument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
在 System.Reflection.Emit.SignatureHelper.AddArguments(Type[] arguments, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
在 System.Reflection.Emit.SignatureHelper.GetMethodSigHelper(Module scope, CallingConventions callingConvention, Int32 cGenericParam, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
在 System.Reflection.Emit.DynamicILGenerator.GetMemberRefToken(MethodBase methodInfo, Type[] optionalParameterTypes)
在 System.Reflection.Emit.DynamicILGenerator.EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes)
在 AspectCore.Extensions.Reflection.MethodReflector.<>c__DisplayClass7_0.g__CreateDelegate|2(Action callback)
在 AspectCore.Extensions.Reflection.MethodReflector.CreateInvoker()
在 AspectCore.Extensions.Reflection.MethodReflector..ctor(MethodInfo reflectionInfo)
在 AspectCore.Extensions.Reflection.MethodReflector.<>c__DisplayClass0_0.g__CreateInternal|0(Pair2 item) 在 System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) 在 AspectCore.Extensions.Reflection.MethodReflector.Create(MethodInfo reflectionInfo, CallOptions callOption) 在 AspectCore.DynamicProxy.ReflectionUtils.IsNonAspect(MethodInfo methodInfo) 在 AspectCore.DynamicProxy.OverwriteAspectValidationHandler.Invoke(AspectValidationContext context, AspectValidationDelegate next) 在 AspectCore.DynamicProxy.CacheAspectValidationHandler.<>c__DisplayClass4_0.<Invoke>b__0(AspectValidationContext tuple) 在 System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func`2 valueFactory)
在 AspectCore.DynamicProxy.CacheAspectValidationHandler.Invoke(AspectValidationContext context, AspectValidationDelegate next)
在 AspectCore.DynamicProxy.AspectValidator.Validate(MethodInfo method, Boolean isStrictValidation)
在 AspectCore.DynamicProxy.AspectValidatorExtensions.Validate(IAspectValidator aspectValidator, Type type, Boolean isStrictValidation)
在 AspectCore.Extensions.DependencyInjection.ServiceValidator.TryValidate(ServiceDescriptor descriptor, Type& implementationType)
在 AspectCore.Extensions.DependencyInjection.ServiceCollectionBuildExtensions.WeaveDynamicProxyService(IServiceCollection services)

是由于我注入接口中有个方法中带有关键字in导致,去掉后注入正常解析。
image