是否可以在实现项目的项目外使用实现Fody weaver的Attribute?] <

问题描述 投票:1回答:1
[在使用实现属性的项目之外的方法上使用实现Fody编织器的属性时,我无法拦截方法连接点。

我已经在项目中实现了MethodDecorator.Fody编织器,但是当我尝试将Attribute添加到项目外部的任何方法时,不会发生编织。但是,它可以在同一项目中工作。

[AttributeUsage(AttributeTargets.Method)] public class RelayExceptionsAttribute : Attribute, IMethodDecorator { public void Init(object instance, MethodBase method, object[] args) { } public void OnException(Exception exception) { Console.WriteLine(exception.Message); } public void OnEntry() { } public void OnExit() { } }

当我在同一项目中的方法上使用此属性时,将按预期方式命中OnException(以及该属性中的其他方法)。当我将其放在项目外部的方法上(但将项目的Attribute定义为引用)时,不会发生拦截。

[在使用实现属性的项目之外的方法上使用实现Fody编织器的Attribute时,我无法截获方法连接点。我已经实现了MethodDecorator.Fody ...

c# aop fody
1个回答
0
投票
将模块应用于MethodDecorator.Fody实现
© www.soinside.com 2019 - 2024. All rights reserved.