Skip to content

Fix up snippets and add note#51946

Merged
adegeo merged 4 commits intomainfrom
adegeo/services/46997
Feb 27, 2026
Merged

Fix up snippets and add note#51946
adegeo merged 4 commits intomainfrom
adegeo/services/46997

Conversation

@adegeo
Copy link
Contributor

@adegeo adegeo commented Feb 27, 2026

Summary

  • Fixed snippets to render the full sample without snippet comments.
  • Added namespaces.
  • Added a note that specified the NuGet package required (and pointed out the worker SDK)
  • Added a note that says you have to implement your own lifetime manager if using a desktop app framework.

Fixes #46997


Internal previews

📄 File 🔗 Preview link
docs/core/extensions/dependency-injection/overview.md .NET dependency injection

@adegeo adegeo requested a review from gewarren as a code owner February 27, 2026 00:53
Copilot AI review requested due to automatic review settings February 27, 2026 00:53
@adegeo adegeo requested a review from a team as a code owner February 27, 2026 00:53
@dotnetrepoman dotnetrepoman bot added this to the February 2026 milestone Feb 27, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Issue #46997 by improving the dependency injection documentation examples to be more complete and executable. The changes add full code context with namespaces, using statements, and helpful notes about required packages and desktop application lifetime management.

Changes:

  • Added explicit using statements and wrapping <All> snippet tag to Program.cs to show the complete executable example
  • Created StandaloneWorker.cs to demonstrate the "bad" pattern of hard-coded dependencies
  • Added IMPORTANT notes about the Worker SDK requirement and NuGet package dependencies
  • Added guidance for desktop app developers about lifetime management integration

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
docs/core/extensions/dependency-injection/snippets/overview/Program.cs Added using statements and <All> snippet wrapper to show complete executable code
docs/core/extensions/dependency-injection/snippets/overview/StandaloneWorker.cs New file demonstrating hard-coded dependency anti-pattern
docs/core/extensions/dependency-injection/overview.md Added SDK and package notes, updated snippet references to show complete examples

adegeo and others added 2 commits February 26, 2026 17:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adegeo adegeo merged commit 066758d into main Feb 27, 2026
11 checks passed
@adegeo adegeo deleted the adegeo/services/46997 branch February 27, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Another incomplete Microsoft Learn example

3 participants