Skip to content

Remove dependency on System.Console in default Blazor WASM app #31148

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
eerhardt opened this issue Mar 23, 2021 · 1 comment · Fixed by #31769
Closed

Remove dependency on System.Console in default Blazor WASM app #31148

eerhardt opened this issue Mar 23, 2021 · 1 comment · Fixed by #31769
Assignees
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly task
Milestone

Comments

@eerhardt
Copy link
Member

There is a single place in a Blazor WASM app that references System.Console:

private static void HandleStartupException(Exception exception)
{
// Logs to console, and causes the error UI to appear
Console.Error.WriteLine(exception);
}

This place is the main entry point for the application, and it catches all exceptions and writes them to the console. Since it is the only place that references System.Console in the application, if we can change this code to not reference System.Console, the whole System.Console.dll assembly can be removed, which is currently at 6KB .br compressed.

One idea on how to remove this is to use Mono's built-in functionality for invoking the Main entrypoint instead of having that functionality in ASP.NET.

cc @lewing @pranavkm @captainsafia @marek-safar

@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly task labels Mar 23, 2021
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone Mar 23, 2021
@ghost
Copy link

ghost commented Mar 23, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@ghost ghost closed this as completed in #31769 Apr 15, 2021
@TanayParikh TanayParikh added the Done This issue has been fixed label Apr 15, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants