System.FormatException: Encountered an invalid type for a default value.
at System.Reflection.MdConstant.GetValue(MetadataImport scope, Int32 token, RuntimeTypeHandle fieldTypeHandle, Boolean raw)
at System.Reflection.RuntimeParameterInfo.GetDefaultValueInternal(Boolean raw)
at System.Reflection.RuntimeParameterInfo.get_HasDefaultValue()
at AspectCore.Utils.ProxyGeneratorUtils.ParameterBuilderUtils.DefineParameters(MethodInfo targetMethod, MethodBuilder methodBuilder)
at AspectCore.Utils.ProxyGeneratorUtils.MethodBuilderUtils.DefineMethod(MethodInfo method, String name, MethodAttributes attributes, Type implType, TypeDesc typeDesc)
at AspectCore.Utils.ProxyGeneratorUtils.MethodBuilderUtils.DefineInterfaceMethod(MethodInfo method, Type implType, TypeDesc typeDesc)
at AspectCore.Utils.ProxyGeneratorUtils.MethodBuilderUtils.DefineInterfaceProxyMethods(Type interfaceType, Type targetType, Type[] additionalInterfaces, TypeDesc typeDesc)
at AspectCore.Utils.ProxyGeneratorUtils.CreateInterfaceProxyInternal(String name, Type interfaceType, Type implType, Type[] additionalInterfaces, IAspectValidator aspectValidator)
at AspectCore.Utils.ProxyGeneratorUtils.CreateInterfaceProxy(Type interfaceType, Type implType, Type[] additionalInterfaces, IAspectValidator aspectValidator)
at AspectCore.DynamicProxy.ProxyTypeGenerator.CreateInterfaceProxyType(Type serviceType, Type implementationType)
at AspectCore.Extensions.DependencyInjection.ServiceCollectionBuildExtensions.MakeProxyService(ServiceDescriptor descriptor, Type implementationType, IProxyTypeGenerator proxyTypeGenerator)
at AspectCore.Extensions.DependencyInjection.ServiceCollectionBuildExtensions.BuildAspectCoreServiceProvider(IServiceCollection services)
// ServiceAccessLogAttribute
public class ServiceAccessLogAttribute : AbstractInterceptorAttribute
{
public override async Task Invoke(AspectContext context, AspectDelegate next)
{
await next(context);
}
}
// Startup.ConfigureServices
services.AddTransient(provider => new ServiceAccessLogAttribute());
services.AddDynamicProxy(config =>
{
config.Interceptors.AddServiced<ServiceAccessLogAttribute>(method =>
{
var isService = method.DeclaringType.Name.EndsWith("Service");
return isService;
});
});
return services.BuildAspectCoreServiceProvider();
OS: Windows 10
dotnet --version: 2.1.104
Target: netcoreapp2.0
AspectCore.Extensions.DependencyInjection: 0.3.1