Skip to content

Correct nested Map middleware example#37120

Merged
wadepickett merged 1 commit intodotnet:mainfrom
yermekyerden:patch-2
May 8, 2026
Merged

Correct nested Map middleware example#37120
wadepickett merged 1 commit intodotnet:mainfrom
yermekyerden:patch-2

Conversation

@yermekyerden
Copy link
Copy Markdown
Contributor

@yermekyerden yermekyerden commented May 8, 2026

Summary

This PR corrects the nested Map middleware example.

The example currently calls app.Run(...) inside the nested branches. Since app is the root application builder, the terminal middleware is registered on the root pipeline instead of the nested branch.

The updated code uses level2AApp.Run(...) and level2BApp.Run(...), which matches the intended nested Map behavior.

Validation

Documentation-only change.


Internal previews

📄 File 🔗 Preview link
aspnetcore/fundamentals/middleware/index.md ASP.NET Core Middleware

Use the nested branch builders for the level2a and level2b Map branches.
@wadepickett wadepickett self-requested a review May 8, 2026 19:48
@wadepickett wadepickett self-assigned this May 8, 2026
@wadepickett
Copy link
Copy Markdown
Contributor

@yermekyerden, Thank very much for identifying this issue and fixing it! Greatly appreciated!!

The original code used app.Run(...) (root pipeline builder) instead of the branch-specific builders level2AApp.Run(...) and level2BApp.Run(...), which would cause incorrect runtime behavior inconsistent with the response table shown in the article.

Copy link
Copy Markdown
Contributor

@wadepickett wadepickett left a comment

Choose a reason for hiding this comment

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

Approved.

@wadepickett wadepickett merged commit 343b5fd into dotnet:main May 8, 2026
4 checks passed
@yermekyerden yermekyerden deleted the patch-2 branch May 8, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants