Skip to content

Release v2.0.11

Choose a tag to compare

@github-actions github-actions released this 15 Sep 03:52
b60f65d

Changed

  • The C# service-lifetime rule now leads with the rule as stated - a type taking a scoped dependency is scoped or transient, never a singleton - and makes deleting [Singleton] the first remedy. IServiceScopeFactory is demoted to the one case that actually needs it: a service the host itself resolves once, such as a BackgroundService, which has no request to inherit a scope from. Presenting the scope factory as the general fix is how an application accumulates dozens of captive dependencies that each look deliberate; a sweep of a real application found several dozen singletons holding a scoped service, not one of which needed to be a singleton.
  • Enforcement now asks for ValidateScopes and ValidateOnBuild in every environment rather than only Development, where the host enables them by default - backwards for a failure whose whole character is that it stays quiet. Spells out the order that matters on an existing codebase: turn them on locally, fix what they name, then let them reach the deployed environments, since doing it the other way converts a silent multi-tenant bug into a failed production start.
  • The C# conventions skill, its dependency-injection reference, the code-review skill and the code-reviewer agent carry the same rule, so none of them can be read as permitting what the rule refuses.