-
Notifications
You must be signed in to change notification settings - Fork 2
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
Introducing LightInject Produces Scoping Error #54
Comments
Hi Mike. Thanks for a very detailed report. Even a video. That is a first 😀 Is this something I can just run or do I need a database and possibly some twitter key/secret? |
Yeah, that's the tricky part about this and a large part on why I was hesitant to report it. It occurs during external login, which is a bit of an effort to setup correctly. Fortunately, the documentation is pretty good: You'll have to create a Twitter app and get the key/secret pair to use that SLN. Once you do, right-click the project file and select And use this as a template:
The one gotcha that kept getting me during setting up the Twitter application is the callback URL. I kept getting For reference, here is what mine looks like, set to the values of the For your copy/pasting the values are:
BTW, if you happen to know another external login (Microsoft Account, Google) I am betting either one of those would work, too. It seems this is happening after successful external authentication so any external provider should do. Don't quote me on that though, I am trying to save you some grief -- any grief at all! 😅 |
Hi again Mike. I'll do my best to try to recreate this. I'm usually on a Mac so I need to update my Windows VM to debug this. I'll keep you posted 👍😀 |
Wow, you develop on a Mac?! That makes LightInject that much more impressive. 😆 (Bad) jokes aside please let me know of any issues you encounter and I'll try my best to help you through them. |
Hi again. I've managed to reproduce the issue and just started to look into what is going on here. The fork is here https://github.com/seesharper/LightInject.Scopes I would really appreciate a second set of eyes on this as I could not immediately see anything fishy apart from the fact that the |
COOL you are able to reproduce it. I was certain that for sure that this was going to boil down to something crazy with my local environment. :) As for assisting... I am unfortunately not too familiar with how scoping works with ASP.NET core -- or really, anything ASP.NET Core 😅 -- so it will take some time to ramp up. Have you been able to add Grace/AutoFac/Unity and see what the difference is when using those DI containers, by chance? All of them manage to load without issue. That stated, I will take a look into the fork and see if there is anything obvious that sticks out. Thank you for creating it (and for looking into this!). 👍 |
A little bit of update on this issue. I have been debugging the hell out this thing and I think we have a race condition related to how instances are cached in a given scope. Anyway, I just wanted to let you know that I have not given up on this👍 |
woohoo! That's great news! I actually have this on my |
I think I finally got it. It turned out to be an AVL tree rotation bug where we mixed up the left nodes in a double rotation. I don't know if you are familiar with AVL trees, but the rotation is necessary to keep the the tree balanced. We use immutable AVL trees where lookup performance is crucial. I'm going to need a day or two to wrap this up, but it looks promising. And a big thanks goes out to you that reported this bug in such detail. 🎂Without this issue, chances would have been high that this sneaky bug could have lived a lot longer and caused some serious trouble. What happened here in this case it that we got back an uninitialized |
Dude that is great news and is wonderful to hear, @seesharper! I thought for sure that this was a lost cause and was so edge case complicated that it would never be located, let alone solved. Obviously consider the particular set of cases to produce this -- and I even thought it was only on my machine. 😆 Much appreciation and respect for finding this and figuring it out!!! |
Hi again Mike. A week of debugging is hopefully over 😀 Could you try to bump
to
|
IT WORKS... dude NICE JOB and thank you sooooo much for putting the effort in fixing this, including going through the hassle of creating a Twitter app! That's COMMENDABLE. I am going to post about your achievement on Twitter now. :) |
Boom. https://twitter.com/MikeTripleE/status/1227622981654007808 Closing this issue now. THANK YOU AGAIN! |
Apologies in advance as this appears to be a complicated issue, and my limited knowledge of the new ASP.NET Core framework at the moment is keeping me from simplifying this further.
I have been fighting for the past day with this issue, and have reduced it to the following factors:
The problem appears to be a scoping issue. The
RemoteNavigationManager
gets created twice on the same request, even though it's scoped to not do so.When authenticating, the request returns from Twitter and sends the user back to the root URL, where this error then occurs. Here is the stack trace:
I've stuck a breakpoint in the constructor of
RemoteNavigationManager
and see that it does get called twice on the same request, with a call fromLightInject.Scope.GetScopedInstance
being the parent call site.So, it would seem that something strange is going on here.
FWIW I have tried the following DI containers and did not encounter this error with them:
So this appears to be, uh, scoped (sorry 😆) to LightInject specifically.
I have created a repo that showcases the issue here:
https://github.com/Mike-EEE/LightInject.Scopes
Here is a video that shows how to reproduce it:
https://youtu.be/do32eM4hvSk
Apologies again for the complexity of the issue. If I find away to simplify it I will be sure to do so and update here.
Until this issue is fixed, I am setting the
render-mode
value fromServerPrerendered
toServer
on this tag here. There appears to be some magic that occurs here that sidesteps this issue.Please let me know if there is any further information I can provide to assist in diagnosing this issue.
The text was updated successfully, but these errors were encountered: