Skip to content

Conversation

@gewarren
Copy link
Contributor

@gewarren gewarren commented Jan 15, 2026

Fixes #50694 by putting all required components into a single code file that's displayed in the snippet window.


Internal previews

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

Copilot AI review requested due to automatic review settings January 15, 2026 22:57
@gewarren gewarren requested a review from a team as a code owner January 15, 2026 22:57
@dotnetrepoman dotnetrepoman bot added this to the January 2026 milestone Jan 15, 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 consolidates the dependency injection example code to make it compilable as a single standalone project. The changes move code from separate files in the dependency-injection folder into a single Program.cs file in the overview folder, remove explicit namespaces to use implicit global namespace (enabled by ImplicitUsings), and update the documentation to reference the consolidated code.

Changes:

  • Consolidated Worker, MessageWriter, and IMessageWriter classes into a single Program.cs file with snippet markers
  • Removed the RootNamespace property from the project file to enable global namespace compilation
  • Removed namespace declarations from LoggingMessageWriter.cs
  • Deleted the dependency-injection folder and its separate source files
  • Updated markdown documentation to reference the consolidated code snippets

Reviewed changes

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

Show a summary per file
File Description
docs/core/extensions/snippets/configuration/overview/dependency-injection.csproj Removed RootNamespace property to allow implicit global namespace
docs/core/extensions/snippets/configuration/overview/Program.cs Created consolidated program with all DI example classes and snippet markers
docs/core/extensions/snippets/configuration/overview/LoggingMessageWriter.cs Removed namespace declaration for global namespace compilation
docs/core/extensions/snippets/configuration/dependency-injection/Worker.cs Deleted - consolidated into Program.cs
docs/core/extensions/snippets/configuration/dependency-injection/Program.cs Deleted - consolidated into overview/Program.cs
docs/core/extensions/snippets/configuration/dependency-injection/MessageWriter.cs Deleted - consolidated into overview/Program.cs
docs/core/extensions/snippets/configuration/dependency-injection/IMessageWriter.cs Deleted - consolidated into overview/Program.cs
docs/core/extensions/dependency-injection.md Updated snippet references and descriptions for the consolidated code

@gewarren gewarren requested a review from BillWagner January 15, 2026 23:15
@gewarren gewarren enabled auto-merge (squash) January 16, 2026 03:08
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

This LGTM @gewarren

Let's :shipit:

@gewarren gewarren merged commit ed8503d into dotnet:main Jan 16, 2026
10 checks passed
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.

[DevComm] DI example doesn't compile

2 participants