-
Notifications
You must be signed in to change notification settings - Fork 10.3k
System.InvalidOperationException: Collection was modified; enumeration operation may not execute in UseEndpoints. #46758
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
Comments
Triage: @MistyKuu Could you provide a complete minimal repro project that uses the problematic package? Ideally something that would reproduce the issue after running |
Hi @MistyKuu. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
might also be interesting to see whether it repros on 7.0 if possible (given #42195 changed relevant code?) |
@danmoseley I believe it won't change anything. It implies that two UseEndpoints are called at the same time which throws above exception. Below code isn't thread safe because it shares the same
From my perspective the issue can be closed but I wonder if it might be a completely valid scenario in other use cases and if it's something to look into. |
@halter73 Any thoughts on this? |
I think we should close this as a duplicate of #27465 which is a general issue to better support application multitenancy. Parallel calls to If each tenant got its own copy of |
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes. See our Issue Management Policies for more information. |
I have recently upgraded to .net 6 (6.0.13). Application is run under docker containers in kubernetes. For some reason some of the pods randomly fails with
System.InvalidOperationException: Collection was modified; enumeration operation may not execute
I'm using multitenancy package https://github.com/saaskit/saaskit which might but not necessarily have to be related to the issue.
In startup this is how it's configured (Configure method):
Call stack:
It is failing there in UseEndpoints:
By looking at the code, UseEndpoints is executed after first request is called, not on startup which might cause this issue
The text was updated successfully, but these errors were encountered: