Skip to content

Conversation

@abhiramch018
Copy link

@abhiramch018 abhiramch018 commented Nov 25, 2025

…injection

Summary

Clarified that resolving services from the built-in .NET dependency injection (DI) container is thread-safe.

Changes

  • Updated the Thread safety section in dependency-injection-guidelines.md.
  • Added explicit statement that:
    • Service resolution via IServiceProvider and IServiceScope is thread-safe.
    • Service implementations themselves must still handle internal concurrency.
  • Added a note block for clarity.

Motivation

Resolves issue #47086 by explicitly documenting DI service resolution thread safety, which was previously implied but not stated.

Summary

Describe your changes here.

Fixes #Issue_Number (if available)


Internal previews

📄 File 🔗 Preview link
docs/core/extensions/dependency-injection-guidelines.md Dependency injection guidelines

…injection

### Summary
Clarified that resolving services from the built-in .NET dependency injection (DI) container is thread-safe.

### Changes
- Updated the **Thread safety** section in `dependency-injection-guidelines.md`.
- Added explicit statement that:
  - Service resolution via `IServiceProvider` and `IServiceScope` is thread-safe.
  - Service implementations themselves must still handle internal concurrency.
- Added a note block for clarity.

### Motivation
Resolves issue dotnet#47086 by explicitly documenting DI service resolution thread safety, which was previously implied but not stated.
@abhiramch018 abhiramch018 requested review from a team and IEvangelist as code owners November 25, 2025 12:18
@dotnetrepoman dotnetrepoman bot added this to the November 2025 milestone Nov 25, 2025
@dotnet-policy-service dotnet-policy-service bot added dotnet-fundamentals/svc community-contribution Indicates PR is created by someone from the .NET community. labels Nov 25, 2025
@abhiramch018
Copy link
Author

Hi @dotnet/docs
I’ve made the suggested updates for this issue.
Please take a quick look when you get a chance — happy to make any additional tweaks if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-fundamentals/svc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant