Skip to content

Blazor browser options are ignored or applied incorrectly #70510

Description

@ilonatommy

Server-configured browser options were introduced by #64807. These behaviors were found while reviewing dotnet/AspNetCore.Docs#38107. Reproduced with .NET SDK 11.0.100-rc.3.26522.148.

Circuit inactivity timeout

In a Blazor Web App with an Interactive Server component on /counter and a static page on /, configure:

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode()
    .WithBrowserOptions(options =>
        options.StaticServer.CircuitInactivityTimeout = TimeSpan.FromMinutes(10));

Open /counter, navigate to / using enhanced navigation, and watch the _blazor WebSocket in the browser's Network tab.

Expected: The circuit remains available for 10 minutes after its last interactive server root component is removed.

Actual: The connection closes after about two seconds. Returning to /counter creates a new circuit.

WebAssembly application culture

Create a Blazor Web App with WebAssembly interactivity named BrowserCultureRepro. Configure its endpoint in BrowserCultureRepro/Program.cs:

app.MapRazorComponents<App>()
    .AddInteractiveWebAssemblyRenderMode()
    .AddAdditionalAssemblies(typeof(BrowserCultureRepro.Client._Imports).Assembly)
    .WithBrowserOptions(options =>
        options.InteractiveWebAssembly.ApplicationCulture = "en-CA");

Add BrowserCultureRepro.Client/Pages/Culture.razor:

@page "/culture"
@rendermode InteractiveWebAssembly
@using System.Globalization

<p>Running in browser: @OperatingSystem.IsBrowser()</p>
<p>Culture: @CultureInfo.CurrentCulture.Name</p>

With the browser locale set to en-US, open /culture and wait for Running in browser: True.

Expected: Culture: en-CA.

Actual: Culture: en-US.

DOM preservation

In the Interactive Server app above, configure:

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode()
    .WithBrowserOptions(options => options.StaticServer.PreserveDom = false);

Open /counter, then use the Home link to navigate to /.

Expected: DOM preservation is disabled and the browser performs a full page load.

Actual: Enhanced navigation still runs and the same document is preserved.

Interactive Server logging

In the same app, configure:

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode()
    .WithBrowserOptions(options => options.LogLevel = LogLevel.Trace);

Open /counter, enable verbose messages in the browser console, and click the counter button.

Expected: Debug messages such as Dispatching event with handler id appear.

Actual: The circuit logger still uses the default warning level, so the debug message is missing.

Reconnection retry interval

In the same app, configure:

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode()
    .WithBrowserOptions(options =>
    {
        options.InteractiveServer.ReconnectionMaxRetries = 2;
        options.InteractiveServer.ReconnectionRetryInterval = TimeSpan.FromMilliseconds(200);
    });

Open /counter, set the browser offline, and run Blazor._internal.forceCloseConnection() in the browser console. Watch the failed /_blazor/negotiate requests.

Expected: The two retry requests occur about 200 ms apart.

Actual: They occur about one second apart. The option reaches the browser; this is a reconnection timer behavior that predates #64807 and also affects the equivalent JavaScript option.

Activity

  1. added
    area-blazor
    on Nov 11, 2026
  2. github-actions commented on Nov 11, 2026

    @github-actions
    Contributor

    Triage Summary

    Area: area-blazor (StaticServer.CircuitInactivityTimeout / WithBrowserOptions, circuit disposal)
    Type: Bug (configured timeout is ignored and the default is used)

    Potential Duplicates

    • None found

    Notes

    • Relevant code: src/Components/Endpoints/src/BrowserConfiguration/StaticServerBrowserOptions.cs and src/Components/Endpoints/src/BrowserConfiguration/ConfigureBrowser.cs; existing tests in src/Components/Endpoints/test/BrowserOptionsTest.cs.
    • Related: [Validation] Setting BrowserOptions from server code #68815 (setting BrowserOptions from server code).

    Generated by Issue Triage Agent for dotnet/aspnetcore for #70510 · copilot · auto · 20.9 AIC · ⌖ 1.02 AIC · ⊞ 7.5K · ◷

  3. changed the title [-]CircuitInactivityTimeout set via WithBrowserOptions is ignored[/-] [+]WithBrowserOptions ignores CircuitInactivityTimeout and ApplicationCulture[/+] on Nov 11, 2026
  4. changed the title [-]WithBrowserOptions ignores CircuitInactivityTimeout and ApplicationCulture[/-] [+]Blazor browser options are ignored or applied incorrectly[/+] on Nov 11, 2026
  5. added this to the 11.0.x milestone on Nov 12, 2026
  6. oroztocil commented on Nov 12, 2026

    @oroztocil
    Member

    This aligns with findings from #68815

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-blazor

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions