AI Chat Web template: scaffolded Identity pages are inaccessible because App.razor applies an interactive render mode unconditionally

Abierto Apto para principiantes
#7,889 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@valkiara ya está trabajando en esto.

Desde el 28/10/2026.

  • #7892 de @valkiara — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp

Línea de trabajo

Comienza en App.razor de la plantilla, donde HeadOutlet y Routes reciben un modo de renderizado incondicional; el issue incluye el patrón PageRenderMode usando HttpContext.AcceptsInteractiveRouting. Reproduce creando el AI Chat Web template, haciendo scaffolding de Identity y navegando a /Account/Register. Hecho significa que las páginas de Identity se renderizan mediante SSR estático mientras el chat permanece interactivo; si los mantenedores prefieren la opción de documentación, añade una nota cerca de la guía de scaffolding de Identity.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area-ai-templates untriaged

Summary

In the AI Chat Web template, App.razor applies an interactive render mode to HeadOutlet and Routes unconditionally. As a result, pages that opt out with [ExcludeFromInteractiveRouting], such as the scaffolded ASP.NET Core Identity pages don't work. The project builds without errors, so the problem only shows up at runtime.

Environment

  • .NET SDK: 10.0.401
  • Template package: Microsoft.Extensions.AI.Templates 10.11.0-preview.3.26513.7
  • IDE: Visual Studio 26 (18.10.3)
  • OS: Windows 10 Pro

Steps to reproduce

  1. Create a new project from the AI Chat Web App template: OpenAI, vector store, Keyless Auth
  2. Scaffold ASP.NET Core Identity: Add > New Scaffolded Item > Identity (all)
  3. Build (succeeds) and run.
  4. Navigate to /Account/Register

Expected behavior

Identity pages render via static SSR so they can use HttpContext and set authentication cookies. The AI chat keeps its interactive rendering.

Actual behavior

Navigating to /Account/Register renders the template's styling but an empty content area.
No exception is thrown, there is nothing in the browser console / server log, and the build is clean.

Cause

[ExcludeFromInteractiveRouting] works as intended, but the root components still apply an interactive render mode regardless of the route:

<HeadOutlet @rendermode="@renderMode" />
<Routes @rendermode="@renderMode" />

Suggested change

Choose the render mode per request, so routes that opt out of interactive routing fall back to static SSR:

<HeadOutlet @rendermode="@PageRenderMode" />
<Routes @rendermode="@PageRenderMode" />

@code {
    [CascadingParameter]
    private HttpContext HttpContext { get; set; } = default!;

    private IComponentRenderMode? PageRenderMode =>
        HttpContext.AcceptsInteractiveRouting()
            ? new InteractiveServerRenderMode(prerender: false)
            : null;
}

This is the same pattern used when Individual Accounts authentication is selected in the standard Blazor Web App template, and it matches the workaround discussed in dotnet/aspnetcore#51170. I confirmed that with this change the AI chat still works as interactive and the Identity pages load.

Scope

I'm not proposing to include Identity in the template. Either of these would help:

  • make the template's App.razor routing-aware, as above, or
  • add a short note to the template docs explaining when to add this switch (for example, before scaffolding Identity).
Lenguaje dominante
C#
Estrellas
3.3k
Forks
916
Merge medio
1 d 13 h
PR fusionados (30 d)
40

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/extensions

Todos los issues de dotnet/extensions

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.