Skip to content

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

Closed
@eerhardt

Description

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

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor Componentsfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblytask

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions