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

[release/9.0] Fix trimming for DiagnosticSource #106842

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 22, 2024

Backport of #106680 to release/9.0

/cc @noahfalk

Customer Impact

  • Customer reported
  • Found internally

A recent change caused a binary size regression for HelloWorld on Mono (Issue #106265).

Regression

  • Yes
  • No

Introduced in #106014

Testing

@vitek-karas confirmed the size had returned to normal looking at automated perf results. It was missed initially because perf testing doesn't occur automatically prior to PR merge and I didn't recognize the impact it would have on the IL linked binaries.

Risk

Low - the change executes exactly the same logic as before with some refactorings applied:

  • Several private static methods were moved verbatim from the EventSource class to a new internal EventSourceInitHelper class
  • [Cosmetic] EventSource fields were moved from the bottom of the class to the top to align with style guidelines. This portion is not necessary for the change to work but it does match what was tested and checked in to the 10.0 branch.

Recent changes to EventSource startup caused the IL trimmer to include portions of the DiagnosticSource assembly. Adding the IsMeterSupported feature check wasn't sufficient because EventSource also roots all of its methods via a DynamicallyAccessedMembers attribute. To ensure that the new methods can be removed when needed I refactored them into a separate EventSourceInitHelper class that won't be rooted by the existing DAM attribute.

When EventSouce.IsSupported is false I'd expect the entire EventSourceInitHelper class to be unreachable. If only EventSource.IsMeterSupported is false then I'd expect PreregisterEventProviders and GetMetricsEventSource() to be unreachable but the rest of the class will remain.

Hopefully this really fixes #106265 this time.
Copy link
Contributor

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved. please get a code review and we can merge when ready

@jeffschwMSFT jeffschwMSFT added the Servicing-approved Approved for servicing release label Aug 22, 2024
@noahfalk
Copy link
Member

@vitek-karas - could you approve this one as well? It should be unmodified from what you saw in the 10.0 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants