Skip to content

Blazor server crashes when dotnetreference calls a c# function with a string as parameter with more than 32707 characters #33748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MarvinKlein1508 opened this issue Jun 22, 2021 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-server ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@MarvinKlein1508
Copy link

Describe the bug

I am generating a CKEditor 5 with a custom library. The editor fires an JavaScript event which is calling a dotnetreference and forward the new content of the editor to the C# function. However this process results in a crash of my blazor server app, when the text exceeds the length of 32700 characters. The real length is 32707 because all content will be wrapped within a <p></p> tag.

To Reproduce

I created a short sample repo which can be found here: https://github.com/MarvinKlein1508/LargeText

Simple add another s to the textbox to trigger the crash.

Exceptions (if any)

I only get this error within the browsers console.
[2021-06-22T08:49:25.907Z] Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'. blazor.server.js:1:5481
log https://localhost:5001/_framework/blazor.server.js:1
stopConnection https://localhost:5001/_framework/blazor.server.js:1
onclose https://localhost:5001/_framework/blazor.server.js:1
close https://localhost:5001/_framework/blazor.server.js:1
stop https://localhost:5001/_framework/blazor.server.js:1
stopInternal https://localhost:5001/_framework/blazor.server.js:1
s https://localhost:5001/_framework/blazor.server.js:1
s https://localhost:5001/_framework/blazor.server.js:1
a https://localhost:5001/_framework/blazor.server.js:1

Further technical details

  • ASP.NET Core version: 5.0.7
    .NET SDK (gemäß "global.json"):
    Version: 6.0.100-preview.3.21202.5
    Commit: aee38a6dd4

Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5\

Host (useful for support):
Version: 6.0.0-preview.3.21201.4
Commit: 236cb21e3c

.NET SDKs installed:
3.1.400-preview-015203 [C:\Program Files\dotnet\sdk]
3.1.410 [C:\Program Files\dotnet\sdk]
5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.103 [C:\Program Files\dotnet\sdk]
5.0.104 [C:\Program Files\dotnet\sdk]
5.0.201 [C:\Program Files\dotnet\sdk]
5.0.202 [C:\Program Files\dotnet\sdk]
5.0.204 [C:\Program Files\dotnet\sdk]
5.0.300-preview.21258.4 [C:\Program Files\dotnet\sdk]
5.0.301 [C:\Program Files\dotnet\sdk]
6.0.100-preview.3.21202.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.1.20452.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.3.21201.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-server labels Jun 22, 2021
@javiercn
Copy link
Member

@MarvinKlein1508 thanks for contacting us.

This is expected, since you are hitting the SignalR message size limit. This limit is there for security reasons, otherwise someone could easily force large allocations on your server.

We are currently working on a feature for 6.0 that will allow you to "stream" payloads to the server that are larger than the SignalR message limit with full control over the total size of the data on the server.

@javiercn
Copy link
Member

See #30289 for details

@javiercn javiercn added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Jun 22, 2021
@ghost ghost added the Status: Resolved label Jun 22, 2021
@javiercn javiercn reopened this Jun 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-server ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

2 participants