dotnet / dotnet/linker

Linking out formatting code

Open
#923 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
392
Forks
128
Avg merge
2d 10h
Merged PRs (30d)
2

Description

Most of the code remaining in a linked hello world is related to formatting, i.e. ToString() overrides.
DateTime.ToString () alone keeps alive about 100k of IL.

Linking these out automatically is very hard. The BCL is full of calls of Object.ToString () on a receiver
whose type is hard to determine at linking time, like elements of object[].
- For reference types, if there are no instances of the type, the overrides are removed already.
- There are valuetypes with significant formatting code like DateTime. Removing their overrides would
require proving that they have no boxed instances, which is very hard because of generics, i.e. for
every box T, it needs to be proven that T is not a given valuetype.

Probably the best solution right now would be to add some kind of user option, i.e:
- remove these ToString () methods (via the substitution mechanism)
or
- keep these ToString () methods.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.