akarpov89 / MicroFlow

Lightweight workflow engine
http://akarpov89.github.io/MicroFlow/
MIT License
156 stars 48 forks source link

Transient service disposal problem #10

Closed pnesterov closed 8 years ago

pnesterov commented 8 years ago

Hi!

Given a disposable transient service:

public interface IDisposableService: IDisposable
{
...
}

public class DisposableService: IDisposableService
{
...
}

added to the flow

protected override void ConfigureServices(IServiceCollection services)
{
      services.AddTransient<IDisposableService, DisposableService>();
}

i use in the activity (which is disposable as well), which throws an exception

public class SomeActivity : BackgroundActivity, IDisposable
{
        public SomeActivity(IDisposableService service)
        {

        }

       public override ExecuteActivity()
       {
           throw new Exception("Porebrik");
       }
...
}

In this case Dispose is not called in the service instance.

akarpov89 commented 8 years ago

@pnesterov Please check out new version of MicroFlow!

pnesterov commented 8 years ago

Thanks for so quick fix