-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Inconsistent resolution failure #378
Comments
@yallie Thanks for the finding and for the test! What is the exception in the failing case? |
Nevermind, I've got the exception. |
I have fixed the bug and added a couple of more tests. Btw, you may consider the alternative to the |
@yallie I am planning to release the version with the fix Today. |
DryIoc v4.7.4 is released |
Maksim, that's great, thanks a lot! 👍
Not sure what you mean? I have no such flag in my setup.
Awesome, thanks for the suggestion! Will look into it. |
Oh, cool, now the app doesn't start at all :) Looks like the new rules are more restrictive than before. [Export, PartCreationPolicy.Shared] // it's a singleton that manages the list of sessions
class SessionManager
{
[Import]
private ExportFactory<IService> Service { get; set; } // scoped helper service
public void CreateSession()
{
using (var service = Service.CreateExport()) // throws ContainerException
{
// DryIoc.ContainerException: 'code: Error.ContainerIsDisposed;'
// message: Container is disposed and should not be used:
}
}
} As far as I understand, pre-fix ExportFactory would resolve the service using the current scope. P.S. The class itself remains the same as it was when running on MEF before migrating to DryIoc. |
Good :/ more issues to the god of issues. |
Perhaps it's the matter of tweaking the MEF's ExportFactory wrapper. |
Hi Maksim,
looks like resolution rules are applied a bit differently to decorated and undecorated services:
Both UndecoratedService and DecoratedService have the same dependencies.
DecoratedService is set up to be created via a factory method like this:
I believe that both resolutions should yield the same result: either both succeed, or both fail.
But here, the undecorated service succeeds to resolve, and decorated one fails.
Let me prepare the unit test demonstrating this.
The text was updated successfully, but these errors were encountered: