-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
Encountering StackOverflowException/Crash with Decorate<T> #117
Milestone
Comments
Hmm, I wonder if this could be because the service is registered as self? |
It could be, @khellang. It's not returning a new instance of a different type/reference, so that might be confusing things here. |
Close by #155 |
Woohoo! Thank you so much for your efforts @khellang, @Mariachi1231, and team. 🙏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Greetings!
First off, really nice work with this library. It has worked very well for my purposes without issue.
Until now. 😁 It could be due to user error, however, so I wanted to check in and verify.
The issue I encountered was with using the
Decorate
method on my EntityFrameworkCore configuration. I have managed to reduce this to the following solution:https://github.com/Mike-E-wins/Scrutor.EntityFramework
In particular, the code to reproduce is here:
https://github.com/Mike-E-wins/Scrutor.EntityFramework/blob/master/Scrutor.EntityFramework/UnitTest1.cs#L9-L17
Note that I was able to remove all EntityFramework code and use a simple singleton registration to reproduce this issue (the actual code where I encountered this is scoped).
When executed, the code either results in a never-ending loop, a
StackOverflowException
, or a crashed process.For further context, I was attempting to create an initialized database due this issue here. So, I was attempting to do something along the line of the following when I encountered this issue:
My current workaround is to do the above with LightInject's Decorate method, but I would rather stick to
IServiceCollection
extension methods if possible, if that makes sense.Thank you for any assistance/consideration towards this matter.
The text was updated successfully, but these errors were encountered: