Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

和Scrutor一起使用的問題 #286

Open
frank58246 opened this issue Jul 17, 2022 · 2 comments
Open

和Scrutor一起使用的問題 #286

frank58246 opened this issue Jul 17, 2022 · 2 comments

Comments

@frank58246
Copy link

你好,想要请教一下
我在.net core专案中
使用Scutor套件做装饰者模式的DI
套用之后
就无法被AspectCore的属性拦截生成Proxy的class
想问你们有遇到过类似的问题吗
谢谢
專案連結 https://github.com/frank58246/AOE_Test
未命名
未命名1 1
未命名1
未命名2

@panosru
Copy link

panosru commented Aug 6, 2022

I have the same issue as frank mentioned.

In addition, if you try to use DynamicProxyServiceProviderFactory with services.Decorate<>() method that is provided by Scrutor like so:

image

You'll be getting the following exception:

Unhandled exception. System.NotImplementedException: The method or operation is not implemented.
   at System.Reflection.MemberInfo.GetCustomAttributesData()
   at System.Reflection.MemberInfo.get_CustomAttributes()
   at AspectCore.Extensions.Reflection.MemberReflector`1..ctor(TMemberInfo reflectionInfo)
   at AspectCore.Extensions.Reflection.TypeReflector..ctor(TypeInfo typeInfo)
   at AspectCore.Extensions.Reflection.TypeReflector.<>c.<Create>b__0_0(TypeInfo info)
   at AspectCore.Extensions.Reflection.ReflectorCacheUtils`2.<>c__DisplayClass1_0.<GetOrAdd>b__0(TMemberInfo k)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at AspectCore.Extensions.Reflection.TypeReflector.Create(TypeInfo typeInfo)
   at AspectCore.Extensions.Reflection.ReflectorExtensions.GetReflector(TypeInfo typeInfo)
   at AspectCore.DynamicProxy.ReflectionUtils.IsNonAspect(TypeInfo typeInfo)
   at AspectCore.Extensions.DependencyInjection.ServiceValidator.TryValidate(ServiceDescriptor descriptor, Type& implementationType)
   at AspectCore.Extensions.DependencyInjection.ServiceCollectionBuildExtensions.WeaveDynamicProxyService(IServiceCollection services)
   at AspectCore.Extensions.DependencyInjection.ServiceCollectionBuildExtensions.BuildDynamicProxyProvider(IServiceCollection services)
   at AspectCore.Extensions.DependencyInjection.DynamicProxyServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder)
   at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
   at Program.<Main>$(String[] args) in /Volumes/Projects/RND/VisualStudio/Demo/AOPDemo/Program.cs:line 24

Debug output:
image

panosru added a commit to panosru/CleanDDDArchitecture that referenced this issue Aug 6, 2022
@KittyChen913
Copy link

KittyChen913 commented Apr 16, 2024

I also encounter the same error, and this issue continues to occur until now. services.Decorate<>()
'System.NotImplementedException: 'The method or operation is not implemented.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants