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
There is a single place in a Blazor WASM app that references
System.Console:aspnetcore/src/Components/WebAssembly/WebAssembly/src/Hosting/EntrypointInvoker.cs
Lines 84 to 88 in 26a88e0
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.Consolein the application, if we can change this code to not referenceSystem.Console, the wholeSystem.Console.dllassembly 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