dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
34.93k stars 9.87k forks source link

Provide diagnostic tools/means for Blazor server #45740

Open petr-horny-bsshop opened 1 year ago

petr-horny-bsshop commented 1 year ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

A very common problem: "We have a page with a form. Rendering this page transfers 132 kB of data from the server via websocket. If I enter a short text in one textbox, the page will be rendered. 13 kB of data is transferred from the server. However, only a minimal part of the page will be changed, which should correspond to tens of bytes. Using the developer tools in the browser, we know that a single element that is a few bytes long is changed."

Provide a way for developers to find out what is in those 13 kB* of data sent from the server.

*Note: values are illustrative.

Describe the solution you'd like

Additional context

At the same time, it would be nice to have an easy way to see which components have been rendered.

Without such basic tools, developers will keep asking "Why is so much data being transferred when there is no subjective reason for it" over and over again, only to find out after a lot of research and debugging that something is wrong with their code.

javiercn commented 1 year ago

@petr-horny-bsshop thanks for contacting us.

At the same time, it would be nice to have an easy way to see which components have been rendered.

You can already do this if you turn the logs to Debug level.

  • On the server, create something like IBlazorDignosticMonitor with a DignoseSentData(object data) method that the developer can implement and register in the ServiceProvider.

You can put a breakpoint in the framework code here as described here and view the data before it is serialized and sent out.

For diagnostic purposes, allow to switch the binary format to a text format, e.g. json.

Debugging will give you access to the data structure in memory before it is serialized.

On the server, create something like IBlazorDignosticMonitor with a DignoseSentData(object data) method that the developer can implement and register in the ServiceProvider.

We do not plan to offer extensibility at this point as it limits our ability to evolve the framework in the future.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost commented 8 months ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.