Add a -reflection-metadata-for-debugger-only flag that emits reflection metadata but does not link them from runtime data structures #40853
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the compiler can avoid emitting reflection metadata with -disable-reflection-metadata flag. The interesting goal of this is that this reduces binary size, as the reflection record (field names, etc.) are not present. Unfortunately, this also basically breaks all debugging. This PR introduces a "middle option" -- the compiler emits the reflection metadata that is consumed by the compiler, but those records are not linked/referenced from the runtime metadata records, therefore they can be captured as a separate build step, and then stripped by the linker (they are unreferenced by anything). That's that this new -reflection-metadata-for-debugger-only flag does.