Skip to content

[draft] Trim ActivitySource via System.Diagnostics.ActivitySource.IsSupported feature #114636

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Apr 14, 2025

  • feature System.Diagnostics.ActivitySource.IsSupported

Contribute to #114635
On top of #114326

@pavelsavara pavelsavara added size-reduction Issues impacting final app size primary for size sensitive workloads area-System.Diagnostics and removed area-System.Net.Http labels Apr 15, 2025
Copy link
Contributor

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

- MSBuild property ActivitySourceSupport
@@ -453,7 +451,14 @@ public IEnumerable<ActivityLink> Links
/// <param name="operationName">Operation's name <see cref="OperationName"/></param>
public Activity(string operationName)
{
Source = s_defaultSource;
if (!ActivitySource.IsSupported)
Copy link
Member

Choose a reason for hiding this comment

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

Why does the linker see the Activity as instantiated so that you have to do this manually?

Copy link
Member Author

Choose a reason for hiding this comment

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

regex /e=".*System.Diagnostics.Activity:: on artifacts\bin\trimmingTests\projects\System.Net.Http.TrimmingTests\DiagnosticsAndMetricsTrimmedTest\win-x64\obj\Release\net10.0\win-x64\linked\linker-dependencies.xml can find 34 member usages. Maybe this is not one of them and I was too defensive.

Copy link
Member Author

Choose a reason for hiding this comment

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

I sent you the file in Teams

# Conflicts:
#	src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Diagnostics size-reduction Issues impacting final app size primary for size sensitive workloads
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants