-
Notifications
You must be signed in to change notification settings - Fork 26
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
Using Autofac and Rin causes problems on application shutdown #14
Comments
When using default MS Dependency Injection, it will never call I fixed it to ignore |
@mayuki Awesome, thanks! Are you sure it doesn't dispose? The documentation says it does in most situations. If you add a service like this: But if you create the object youself like this: I see you are doing the later:
Maybe it should be:
That way the dependency injected services will get disposed regardless of the container? But it might cause the problem I still have with Autofac, so it should probably get fixed first lol I tried 1.0.5, and I don't see the exception being thrown, but I still see a |
@kevindqc Thank you very much for your advice about DI behavior!
Press I guess the HTTP server (Kestrel) is waiting for WebSocket connections to close. For example, Close the browser tab of |
Yeah I thought the same thing, websockets might keep the Also, if the websockets are the cause of the For me using the repro project, when I CTRL+C it, the |
Hi! I love Rin! Unfortunately, it seems it doesn't like when used with Autfac.
I uploaded a repro repository here:
https://github.com/kevindqc/RinShutdownProblemRepro
The problem happens when I run
dotnet run
, and after that press CTRL+C.The app doesn't close down properly. On the repro repository, it crashes, but in my actual project, it logs an error and the dotnet processes stay open - if I try to run
dotnet run
it doesn't work because the files (DLLs) are in use. This slows down development considerably as I have to kill the 4 left-opened dotnet processes constantly.The exception is:
It seems that Autofac is disposing
MessageEventBus
, which in itsDispose
method waits for a task, but that task has already been canceled. Maybe the dispose order is different when using Autofac vs. using MS Dependency Injection? I made a branch that doesn't use Autofac, and I don't seem to have the problem:https://github.com/kevindqc/RinShutdownProblemRepro/tree/WithoutAutofac
The text was updated successfully, but these errors were encountered: