Repository navigation
Description
Scenario contact: @javiercn
Scenario
Settings that govern how a Blazor app behaves in the browser, such as how noisy its logging is and how hard it tries to reconnect after losing its connection, have traditionally been written in JavaScript at the bottom of a page. That puts them out of reach of configuration files, feature flags and anything that varies per request. This validates that those settings can be decided in server code instead, including differently for different visitors.
Minimum build
.NET 11 RC1 or later.
Configurations to cover
- Blazor Web App
- Static SSR
- Interactive Server
- Interactive WebAssembly
- Interactive Auto
- Standalone WebAssembly
- Hybrid (MAUI)
Also exercise
- Published output
- An existing .NET 10 app upgraded to .NET 11
- Trimming or ahead-of-time compilation
- More than one server instance, or a proxy in front
- Hot Reload
- An IDE as well as the command line
- Container
Setup
You need to be able to stop and restart the server while the browser stays open, so you can watch what happens to a live app when its connection drops and comes back.
Two places set these options, and both are worth covering:
MapRazorComponents<App>().WithBrowserOptions(...)in server startup, which applies to the whole endpoint.- A
<ConfigureBrowser Options="..." />component in the page, which can vary per request.
BrowserOptions.GetBrowserOptions(httpContext) reads what is currently in effect.
What to build
An app whose browser-side behavior is decided in server code rather than in a script on the page. Through WithBrowserOptions, set LogLevel, and set InteractiveServer.ReconnectionMaxRetries and InteractiveServer.ReconnectionRetryInterval to something clearly different from the default, such as far fewer attempts spaced further apart. Point InteractiveServer.ReconnectionDialogId at reconnection UI of your own so you can tell yours from the built-in one.
Then add a <ConfigureBrowser> in the page that varies some of these by request, for example turning detailed logging on only for requests carrying a particular query string or header, or only for a signed-in administrator, so you can compare two browsers side by side.
Add a page whose content changes when you navigate to it, and drive StaticServer.PreserveDom from the server, so you can see the effect of DOM preservation being switched off.
Things to try
- Loading the app and watching the browser console for the amount of logging you asked for.
- Loading it again with the condition that turns on detailed logging, and comparing.
- Opening two browsers at once, one meeting the condition and one not.
- Stopping the server while the app is open, and watching the reconnection attempts and your own reconnection dialog.
- Restarting the server and seeing whether the app recovers.
- Stopping it for longer than your reconnection settings allow, so the attempts run out.
- Navigating between pages with
StaticServer.PreserveDomset totrueand tofalse. - Setting an option at the endpoint and overriding it per request with
<ConfigureBrowser>, to see which wins. - Reading back the values with
BrowserOptions.GetBrowserOptions(httpContext)and comparing them with what the browser actually did. - Removing the server-side settings entirely to confirm the defaults return.
Expected behavior
Options set in server code reach the browser, and options that vary by request vary independently for each visitor.
Must hold
- The browser console shows the level set in
LogLevel, not the default level. - Reconnection follows
ReconnectionMaxRetriesandReconnectionRetryIntervalrather than the defaults, and the dialog named byReconnectionDialogIdis used instead of the built-in one. - Two browsers loading the app at the same time, one meeting the request-based condition and one not, receive different settings.
- Setting
StaticServer.PreserveDomtofalsevisibly stops DOM preservation across enhanced navigation, andtruerestores it. This property is the inverse of the underlying option, so confirm the sense is not flipped. - When the attempts run out, the app reaches the same end state it would have reached with the defaults.
- Removing the server-side configuration restores the default behavior with nothing left over.
Expected differences between configurations
- Reconnection behavior is only observable in the configurations that keep a live connection to the server. In Interactive Auto it applies on the visits that run on the server.
Documentation to use
The API names above were taken from the shipped code, not from docs. If you cannot find this documented anywhere, say so in the report.
What to report
Report results using the format described in the validation testing manual. Include link to a repository with the test app.
Note
Disclaimer: This validation scenario may have been written with AI assistance and may contain errors. It is a testing aid, not an official specification of intended behavior or security guarantees. Its expectations alone do not establish a bug or vulnerability. Verify suspected issues independently against official documentation and reproducible product behavior before reporting them.
Activity
irfanajaffer commentedon Sep 4, 2026
Test report
11.0.100-preview.7.26381.103PreserveDomvalues; concurrent visitors; and two Interactive Server instances behind a YARP proxyGetBrowserOptions(HttpContext)usage in #68815 does not match the shipped API invocation #69045LogLeveldifferentiation and thePreserveDominverse behavior failed. Effective request and visitor isolation could not be demonstrated because browser logging did not provide a behavioral discriminator.All three samples built with zero warnings and zero errors.
Checks
sameNode=trueandclientStatePreserved=true.sameNode=trueandclientStatePreserved=true. PreserveDom comparisonLogLevel.WarningandLogLevel.Traceproduce distinguishable browser output.Informationstartup messages. Static SSR output was empty or otherwise non-differentiating. Static SSR comparison, Server normal, Server detailedLogLevel.For the logging comparison, the normal request used
LogLevel.Warningand the detailed request usedLogLevel.Trace. Both Interactive Server requests emitted the same BlazorInformationstartup messages, includingNormalizing '_blazor'andWebSocket connected; no repeatable Trace/Debug distinction appeared.Both
Ssr.PreserveDom=falseandSsr.PreserveDom=trueproducedsameNode=true,clientStatePreserved=true, andfocusPreserved=false. The validation therefore records both DOM preservation checks as Failed because the expected inverse behavior was not demonstrated. No manualBlazor.startconfiguration fallback was used.Problems
The API names in #68815 differ from the API surface exposed by the pinned Preview 7 SDK. As in the #68816 validation report, these are issue-description/API-name differences rather than sample build failures.
InteractiveServer.ReconnectionMaxRetriesServer.ReconnectionMaxRetriesInteractiveServer.ReconnectionRetryIntervalServer.ReconnectionRetryIntervalInteractiveServer.ReconnectionDialogIdServer.ReconnectionDialogIdStaticServer.PreserveDomSsr.PreserveDomBrowserOptions.GetBrowserOptions(HttpContext)HttpContext.GetBrowserOptions()fromMicrosoft.AspNetCore.ComponentsWithBrowserOptions(...)WithBrowserOptions(...)<ConfigureBrowser Options="..." /><ConfigureBrowser Options="..." />The samples therefore used the Preview 7 property paths:
During the original validation, following
BrowserOptions.GetBrowserOptions(httpContext)as thoughBrowserOptionswere the receiver producedCS1061, so effective-options readback was recorded as not verifiable. The follow-up investigation in #69045 confirmed that Preview 7 ships the API as anHttpContextextension method:The namespace is required because it is not included in the Web SDK implicit usings. This corrects the earlier conclusion that no corresponding Preview 7 member exists, but it does not retroactively turn the original effective-options comparisons into passes; those scenarios remain not demonstrated or inconclusive based on the captured behavioral evidence.
The remaining behavioral problems are:
LogLevel.WarningandLogLevel.Trace.Ssr.PreserveDom=falsedid not produce the inverse ofSsr.PreserveDom=true; both settings preserved node identity and client state in the corrected enhanced-navigation fixture.Could the scenario owner confirm whether
ServerandSsrare the intended Preview 7 property paths, and whether the observedLogLevelandSsr.PreserveDom=falsebehavior should be reported as product defects?Not covered
Only the effective-options readback checks that depended on the
BrowserOptions.GetBrowserOptions(HttpContext)notation in #68815 were not tested during the original validation. As documented in #69045, the shipped Preview 7 invocation ishttpContext.GetBrowserOptions()withMicrosoft.AspNetCore.Componentsimported.irfanajaffer commentedon Sep 4, 2026
The application was again tested using .NET SDK 11.0.100-rc.2.26453.114, and the shipped API BrowserOptions.GetBrowserOptions(HttpContext) is available and functioning as expected.
Validation confirmed both compile-time and runtime availability:
I have also published the updated validation sample in the repository and used it as the basis for the verification scenarios:
[BrowserOptions API Verification Sample](https://github.com/irfanajaffer/BrowseroptionsApiVerification/tree/main)
In addition, the browser option properties validated in the original scenario remain available and functional in the RC build, including:
Based on these validation results, the scenario remains applicable for RC1 and later releases. The shipped API surface was successfully validated, but the behavioral failures observed during validation remain unchanged.
All originally identified validation concerns have now been addressed and verified. No pending validation work remains for this scenario.
oroztocil commentedon Sep 4, 2026
@irfanajaffer Thanks for re-testing with RC1. Do I understand correctly that all the failed checks from the first report #68815 (comment) are fixed in RC1? Or do any of the problems transfer to RC1, when using the latest API?
irfanajaffer commentedon Sep 7, 2026
@oroztocil ,
Thanks for the update. We were able to only confirm that the APIs referenced in the issue are available in the RC1 build as expected.
However, the validation scenarios that were previously documented as failed in my earlier update are still failing even when tested against RC1. The API availability issue appears to be resolved, but the behavioral failures observed during validation remain unchanged.
Could you please review these failed cases from your end and share your feedback on whether the current behavior is expected or if any additional configuration/testing approach is required?
Thanks.
oroztocil commentedon Nov 30, 2026
The remaining issue has been tracked and fixed in #70510.