Skip to content

ActivityTraceFlags is not reflected in Activity Id when updated after activity start() #61857

Open

Description

Description

ActivityTraceFlags can be updated after activity is started. However, doing so does not update the activity Id.

Reproduction Steps

var activity = new Activity("Test");
activity.Start();
Console.WriteLine("ActivityId Before TraceFlags are set: " + activity.Id);
Console.WriteLine("ActivityTraceFlags Before: " + activity.ActivityTraceFlags);
activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
Console.WriteLine("ActivityId After TraceFlags are set: " + activity.Id);
Console.WriteLine("ActivityTraceFlags After: " + activity.ActivityTraceFlags);

---- sample output ----
ActivityId Before TraceFlags are set: 00-b33ee4ebf1fa3d81e0ab30363fe291e2-40f3aace946db1d2-00
ActivityTraceFlags Before: None
ActivityId After TraceFlags are set: 00-b33ee4ebf1fa3d81e0ab30363fe291e2-40f3aace946db1d2-00
ActivityTraceFlags After: Recorded

Expected behavior

Updated ActivityTraceFlags is reflected in Activity.Id

Actual behavior

Updated ActivityTraceFlags is not reflected in Activity.Id

Regression?

No

Known Workarounds

No response

Configuration

No response

Other information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions