Skip to content
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

DryIoc Exeption in a Contructor of a Dependecy does tunnel through Resolve call #536

Closed
jogibear9988 opened this issue Oct 27, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jogibear9988
Copy link

We have a Dependecy wich throws a Exceptin in a constructor.

On a other Place, we use the Container to Resolve a Interface wich has the failing class as Parameter.

there we get this exception after a Timeout:
image

Is it possible to configure DryIoc to fail directly with the first exception?

@dadhi
Copy link
Owner

dadhi commented Oct 27, 2022

Could you provide a small repro/illustrating test?

@jogibear9988
Copy link
Author

My first minimal example does work as it should: https://dotnetfiddle.net/TNKroS
I now look whats different in our code.

@jogibear9988
Copy link
Author

I now found it. The first call raises the exception, the second one throws this error:

https://dotnetfiddle.net/N2GdDR

@dadhi dadhi self-assigned this Oct 27, 2022
@dadhi dadhi added the enhancement New feature or request label Oct 27, 2022
@jogibear9988
Copy link
Author

maybe it's possible to store the exception and rethrow it? is that allowed?

@dadhi
Copy link
Owner

dadhi commented Oct 28, 2022

@jogibear9988 Looking...

@jogibear9988
Copy link
Author

https://dotnetfiddle.net/nudfxA
So seems a rethrow is allowed or works.
So maybe you could store the Exception when a Singelton could not be created, and rethrow when it's resolved again.

dadhi added a commit that referenced this issue Oct 29, 2022
dadhi added a commit that referenced this issue Oct 29, 2022
@dadhi dadhi closed this as completed in 4d5130f Nov 1, 2022
@dadhi dadhi added this to the v5.3.0 milestone Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants