Open msallin opened 3 years ago
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti See info in area-owners.md if you want to be subscribed.
Author: | msallin |
---|---|
Assignees: | - |
Labels: | `area-System.Diagnostics.Tracing`, `untriaged` |
Milestone: | - |
Tagging subscribers to this area: @tarekgh See info in area-owners.md if you want to be subscribed.
Author: | msallin |
---|---|
Assignees: | - |
Labels: | `area-System.Diagnostics.Activity`, `area-System.Diagnostics.Tracing`, `code-analyzer` |
Milestone: | - |
@tarekgh, is this really a code analyzer, or are you just considering obsoleting the property if it really shouldn't be used anymore?
It is more considering obsoletion. The analyzer will be needed only if we don't obsolete it.
CC @noahfalk
Yes, please mark Tags as obsolete in .NET 8. I couldn't find anything in the .NET 7 docs about which one to use or prefer. Finally, a web search for "activity tags vs tagobjects" linked to this issue as the 7th link down. That's too much of a treasure hunt to figure out the preferred API. An [Obsolete] attribute on Tags that said to use TagObjects instead would be much better.
The
Activity.Tags
property only return tags which areKeyValuePair<string, string>
and shouldn't be used anymore. Having both without any hints about this is confusing for the customer and might lead to mistakes.Don't use anymore: https://github.com/dotnet/runtime/blob/79ae74f5ca5c8a6fe3a48935e85bd7374959c570/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs#L271-L280
Use: https://github.com/dotnet/runtime/blob/79ae74f5ca5c8a6fe3a48935e85bd7374959c570/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs#L282-L289
For details see discussion with @tarekgh https://github.com/dotnet/runtime/pull/48722#discussion_r589087042