Skip to content

Crash when PersistentState size > signalr packet size #63690

@davhdavh

Description

@davhdavh

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Serializing too big value results in client error only, and the error has nothing to do with running out of size.

Expected Behavior

Server side log of "[PersistentState] failed to serialize due to exceeding max size" and no value stored so page generally works.

Steps To Reproduce

@page "/CrashMe"
@rendermode InteractiveServer

@code {

 [PersistentState] public string? Size { get; set; }

 protected override void OnInitialized()
 {
  Size ??=   new string(' ', 33000); //<-- adjust based on signalr size
  base.OnInitialized();
 }
}

Exceptions (if any)

{"LogLevel":"dbug","Category":"Microsoft.AspNetCore.Components.Infrastructure.PersistentStateValueProvider","Message":"Persisting value for storage key 'C785CK8khNb/Sy/a6SCdBFMSQz/+6HiZ+JrFnc1a+cE=' of type 'String' from component 'CrashMe' for property 'Size'","TraceID":"bee41b484c25b49d17d5bb2119d2ae06","SpanID":"397e4dfbacff334b","Timestamp":"2025-09-16T04:18:51.3539421Z"}
{"LogLevel":"dbug","Category":"Microsoft.AspNetCore.Components.Infrastructure.PersistentStateValueProvider","Message":"Persisting value for storage key '9lBB97fs0JtFcROKh5YEUEUbwrXZBG1ttURT0f9Cpr8=' of type 'Nullable`1' from component 'CrashMe' for property 'Id'","TraceID":"bee41b484c25b49d17d5bb2119d2ae06","SpanID":"397e4dfbacff334b","Timestamp":"2025-09-16T04:18:51.3543959Z"}
{"LogLevel":"dbug","Category":"Microsoft.AspNetCore.Components.Server.Circuits.CircuitRegistry","Message":"Attempting to disconnect circuit with id WzlubqEnxk0AyKTsDUAny6Mo4p8SXtxrpibQPvMQ8jE from connection czHJ5ep4MuaYsra_o9hJLg.","TraceID":"7c8015de96fea12cda59c7269924465d","SpanID":"83f1b1487be301af","Timestamp":"2025-09-16T04:18:51.4691385Z"}
Navigated to https://localhost:7226/CrashMe
blazor.web.4n3g7fqvoz.js:1 [2025-09-16T04:22:32.216Z] Information: Normalizing '_blazor' to 'https://localhost:7226/_blazor'.
blazor.web.4n3g7fqvoz.js:1 [2025-09-16T04:22:32.239Z] Information: WebSocket connected to wss://localhost:7226/_blazor?id=bN4lFf8dAuz9xu-wJvoqAQ.
blazor.web.4n3g7fqvoz.js:1  [2025-09-16T04:22:32.288Z] Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'.
log @ blazor.web.4n3g7fqvoz.js:1
_stopConnection @ blazor.web.4n3g7fqvoz.js:1
features.reconnect.transport.onclose @ blazor.web.4n3g7fqvoz.js:1
_close @ blazor.web.4n3g7fqvoz.js:1
stop @ blazor.web.4n3g7fqvoz.js:1
_stopInternal @ blazor.web.4n3g7fqvoz.js:1
await in _stopInternal
stop @ blazor.web.4n3g7fqvoz.js:1
_processIncomingData @ blazor.web.4n3g7fqvoz.js:1
Cn.connection.onreceive @ blazor.web.4n3g7fqvoz.js:1
i.onmessage @ blazor.web.4n3g7fqvoz.js:1


blazor.web.4n3g7fqvoz.js:1  Uncaught (in promise) Error: Server returned an error on close: Connection closed with an error.
    at Cn._processIncomingData (blazor.web.4n3g7fqvoz.js:1:66670)
    at Cn.connection.onreceive (blazor.web.4n3g7fqvoz.js:1:59835)
    at i.onmessage (blazor.web.4n3g7fqvoz.js:1:83928)
_processIncomingData @ blazor.web.4n3g7fqvoz.js:1
Cn.connection.onreceive @ blazor.web.4n3g7fqvoz.js:1
i.onmessage @ blazor.web.4n3g7fqvoz.js:1

.NET Version

10.0.100-rc.1.25451.107

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions