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

不会调用Disposable方法 #19

Closed li-zheng-hao closed 2 years ago

li-zheng-hao commented 2 years ago
public class NeedCacheAttribute:Rougamo.MoAttribute,IDisposable
{
    public void Dispose()
    {
        _scope.Dispose();
    }
   private ILifetimeScope _scope { get; set; }
 }

用了autofac,需要在销毁的时候也调用一下scope销毁一些transient、scoped级别的对象,但是试了一下不会进入dispose方法,是什么原因呢?而且autofac的属性注入也无效(设置了public)

li-zheng-hao commented 2 years ago

我的问题,加个析构函数等gc就可以了