inversionhourglass / Rougamo

Compile-time AOP component. Works with any method, whether it is async or sync, instance or static. Uses an aspectj-like pattern to match methods.
MIT License
393 stars 47 forks source link

拦截泛型方法时报错 #27

Closed tiansfather closed 1 year ago

tiansfather commented 1 year ago

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at Rougamo.ExMoAttribute.TryResolve(Type type, Func`3& func) at Rougamo.ExMoAttribute.OnSuccess(MethodContext context)

代码如下: ` using Rougamo.Context; using Rougamo; using System.Threading.Tasks; using System;

//Unhandled exception.System.NullReferenceException: Object reference not set to an instance of an object. // at Rougamo.ExMoAttribute.TryResolve(Type type, Func`3& func) // at Rougamo.ExMoAttribute.OnSuccess(MethodContext context) new TestClass().Get(); Console.ReadLine();

public class TestClass { [General] [Ex] public T Get() where T : new() { return new T(); } }

internal class GeneralAttribute : MoAttribute { public override void OnSuccess(MethodContext context) { Console.WriteLine("success"); } }

internal class ExAttribute : ExMoAttribute { protected override void ExOnSuccess(MethodContext context) { Console.WriteLine("exsuccess"); } } `

inversionhourglass commented 1 year ago

感谢反馈,bug将尽快修复

inversionhourglass commented 1 year ago

发布了1.2.2-beta1.3.1-beta,你可以先升级到beta版本使用,目前还有一些其他工作,晚些时候会做更多测试,然后发布正式版,在使用beta版时有任何其他问题都可以在这个issue下继续反馈,等发布正式版nuget时再关闭该issue

tiansfather commented 1 year ago

好的,谢谢

inversionhourglass commented 1 year ago

已发布1.3.1版本