-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
hangfire use dryioc report ContainerIsDisposed #435
Comments
@d18zj Interesting, thanks for the whole app. |
You can use this demo to quickly recreate this problem with hangfire's dashboard (dashboard url: http://localhost:5000/hangfire) |
@d18zj Ack. Will look, for now I have no ideas why container is used afterwards. Probably I will search first for the similar errors in other IOCs. |
@dadhi This problem can be replaced with the following test code:
Autofac and Microsoft.Extensions.DependencyInjection can pass the test.
|
@d18zj wow, this is much better / simplier thing to check. |
@d18zj Found the bug the injected service provider for the root singletons is the scoped one instead of the root container (which it should be). Fix is in progress |
The DryIoc v4.8.4 with the fix is released |
Can confirm that this bug still present on v4.8.4. Normal .NET 5 (last patch) web app, with builder (where the provider factory uses DryIocAdapter of MS DI under the hood): .UseServiceProviderFactory(new DryIocServiceProviderFactory(new Container(rules => rules
.WithoutThrowOnRegisteringDisposableTransient()
.WithoutThrowIfDependencyHasShorterReuseLifespan()
.WithCaptureContainerDisposeStackTrace()
.WithDefaultReuse(Reuse.Scoped)
, scopeContext: new AsyncLocalScopeContext()))) Dispose exception stack:
|
@detoxhby Any particular reason to use |
@dadhi yes, there is a service locator pattern applied and the whole system needs to stay in sync by leveraging same async flow statically It is somewhat a legacy part of the framework but it cannot be dropped based on usage (I know SL is considered antipattern and I agree in most cases but in huge systems it makes the code more maintainable). If you have another suggestion to replace this scope context with something different that deals with the same concept of async flow we can adopt that. |
@detoxhby Hello. Given your not as simple setup, I think the fastest way to find the breaking change is to look at the history of changes starting from the working version https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/VersionHistory.md Otherwise (ignoring the luck) I need the smallest repro test for the issue. Btw, why did you silence the lifespan mismatch check in the rules? |
@detoxhby Anything new on this issue? |
@detoxhby ...and immediately I have found the suspicious change in v4.7.4. Will be checking it. |
@dadhi yeah we identified the core change but it's not yet trivial for us if that scope/scopecontext handling related changes could be okay with this simple change (e.g. introducing another flag to control this) mainly, we need the |
seemingly it is fixed |
@dadhi thanks, gonna test the new release properly next week 👍🏻 |
@dadhi seems like everything is working fine, thanks for rework |
The following exception is reported when a historical job is requeue:
Program.cs
Startup.cs
HangfireTest.csproj
The text was updated successfully, but these errors were encountered: