Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#7,889 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@valkiara ci sta già lavorando.

Dal 28/10/2026.

  • #7892 di @valkiara — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

Inizia in App.razor del template, dove HeadOutlet e Routes ricevono una modalità di rendering incondizionata; l'issue include il pattern PageRenderMode che usa HttpContext.AcceptsInteractiveRouting. Riproduci creando il AI Chat Web template, eseguendo lo scaffolding di Identity e navigando a /Account/Register. Fatto significa che le pagine Identity vengono renderizzate tramite SSR statico mentre la chat rimane interattiva; se i maintainer preferiscono l'opzione documentazione, aggiungi una nota vicino alla guida allo scaffolding di Identity.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).
Lingua principale
C#
Stelle
3.3k
Fork
916
Merge medio
1g 13h
PR unite (30g)
40

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotnet/extensions

Tutte le issue di dotnet/extensions

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.