Skip to content
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

[Bug] Pasting large json crashes monaco editor #4238

Closed
1 of 2 tasks
MikeWilliams-UK opened this issue Nov 2, 2023 · 3 comments
Closed
1 of 2 tasks

[Bug] Pasting large json crashes monaco editor #4238

MikeWilliams-UK opened this issue Nov 2, 2023 · 3 comments

Comments

@MikeWilliams-UK
Copy link

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html

Monaco Editor Playground Code

const value = /* set from `myEditor.getModel()`: */ `{
	"hello": "World"
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "json",
	automaticLayout: true,
});

Reproduction Steps

Using Starting with the basic Hello World.
Change language to json.
Then paste a large json string (approx 1Mb) into the preview pane.
NB: I cannot supply the json for privicy and security reasons.
Page locks up for just under 2 minutes.

Actual (Problematic) Behavior

Page freezes for just under 2 minutes

Expected Behavior

Page should not freeze

Additional Context

I think this might be the root issue for the following issues with running Monaco in Blazor
serdarciplak/BlazorMonaco#109
serdarciplak/BlazorMonaco#106

I thik the problem occurs when the JavaScript pane is executing myEditor.getModel() as hinted by the comment

VS Code Desktop app handles my large json file witout any issues.

@MikeWilliams-UK
Copy link
Author

Similar result is seen with 260k json file, however the delay befor the screen becomes responsive is shorter

@MikeWilliams-UK
Copy link
Author

My issue has now been solved by adding
builder.Services.AddSignalR(e => {
e.MaximumReceiveMessageSize = 1024 * 1024 * 100;
});

My issue is now fixed albeit with program.cs now like this

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();

builder.Services.AddSignalR(e => {
    e.MaximumReceiveMessageSize = 1024 * 1024 * 100;
});

@MikeWilliams-UK
Copy link
Author

See above

@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant