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

Add linker step to remove calls to Console.WriteLine #16781

Open
rolfbjarne opened this issue Nov 16, 2022 · 0 comments
Open

Add linker step to remove calls to Console.WriteLine #16781

rolfbjarne opened this issue Nov 16, 2022 · 0 comments
Labels
app-size enhancement The issue or pull request is an enhancement good first issue This is a good first issue for someone to start working with our code
Milestone

Comments

@rolfbjarne
Copy link
Member

The System.Console assembly is quite expensive size-wise, so an idea might be to add a linker step that can replace calls to Console.WriteLine (and other related Console functions) with nops.

This could be extended to take a user-provided list of functions to replace with nops (this should be fairly trivial to implement if we decided that these functions must be void functions with no ref/out/pointer arguments).

In the particular case for Console.WriteLine, we could have a few modes:

  • Disabled.
  • Detect & warn.
  • Detect & remove (for instance for release builds).

Ref: dotnet/maui#11405

@rolfbjarne rolfbjarne added enhancement The issue or pull request is an enhancement app-size labels Nov 16, 2022
@rolfbjarne rolfbjarne added this to the .NET 8 milestone Nov 16, 2022
@rolfbjarne rolfbjarne modified the milestones: .NET 8, .NET 9 Sep 11, 2023
@rolfbjarne rolfbjarne added the good first issue This is a good first issue for someone to start working with our code label Sep 11, 2023
@github-project-automation github-project-automation bot moved this to Optimizations in .NET 9 Aug 27, 2024
@rolfbjarne rolfbjarne modified the milestones: .NET 9, .NET 10 Sep 26, 2024
@rolfbjarne rolfbjarne removed this from .NET 9 Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-size enhancement The issue or pull request is an enhancement good first issue This is a good first issue for someone to start working with our code
Projects
None yet
Development

No branches or pull requests

1 participant