Wrap AddDatabaseDeveloperPageExceptionFilter() in IsDevelopment() guard#52774
Open
Wrap AddDatabaseDeveloperPageExceptionFilter() in IsDevelopment() guard#52774
Conversation
…ter() calls Agent-Logs-Url: https://github.com/dotnet/docs/sessions/dd9b2ea5-4aa5-48f9-8be3-6ac8e7d611a9 Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add 2nd conditional to standard templates for ConfigureServices
Wrap AddDatabaseDeveloperPageExceptionFilter() in IsDevelopment() guard
Mar 31, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates architecture guide code samples to register AddDatabaseDeveloperPageExceptionFilter() only in development, preventing production apps from enabling a dev-only diagnostic service that can expose sensitive database details.
Changes:
- Wrapped
AddDatabaseDeveloperPageExceptionFilter()inif (builder.Environment.IsDevelopment()) { ... }in three documentation code samples. - Aligned the service-registration pattern with the existing
app.UseMigrationsEndPoint()development-only guard shown in the same samples.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/architecture/blazor-for-web-forms-developers/project-structure.md | Updates the Program.cs sample to conditionally add the database developer exception filter in development only. |
| docs/architecture/blazor-for-web-forms-developers/security-authentication-authorization.md | Updates the EF Core/Identity configuration snippet to guard the dev-only exception filter behind IsDevelopment(). |
| docs/architecture/modern-web-apps-azure/develop-asp-net-core-mvc-apps.md | Updates the Identity configuration sample to register the database developer exception filter only for development environments. |
BillWagner
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AddDatabaseDeveloperPageExceptionFilter()is a development-only service that exposes sensitive database information. Three architecture doc code samples registered it unconditionally, meaning production apps following these examples would register a dev-only diagnostic service unnecessarily.Fixes #23037
Changes
blazor-for-web-forms-developers/project-structure.mdblazor-for-web-forms-developers/security-authentication-authorization.mdmodern-web-apps-azure/develop-asp-net-core-mvc-apps.mdAll three samples updated from:
to:
This matches the existing pattern already used in these same files for
app.UseMigrationsEndPoint().Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
learn.microsoft.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Internal previews