Why is ValidateScope only true when the Environment is "Development" or "Production" #94202
Unanswered
haridasnykiel
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I'm curious about this too. If I ask ChatGPT, it mentions performance, but I can't find any mentioning of that anywhere. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Why is this designed this way? In my mind it would make more sense to default the ValidateScope to true and have a configuration that will set it to false if required.
This is the property that validates scope when you start up an application using the WebHostBuilder. When you have a scoped service injected into a singleton service the validation will throw an exception like this:
InvalidOperationException: Cannot consume scoped service '' from singleton
Ref: dotnet/docs/issues/29147
Beta Was this translation helpful? Give feedback.
All reactions