Default ActivityIdFormat is W3C

The default identifier format for activity (Activity.DefaultIdFormat) is now ActivityIdFormat.W3C.

Change description

The W3C activity ID format was introduced in .NET Core 3.0 as an alternative to the hierarchical ID format. However, to preserve compatibility, the W3C format wasn't made the default until .NET 5.0. The default was changed in .NET 5.0 because the W3C format has been ratified and gained traction across multiple language implementations.

If your app targets a platform other than .NET 5.0 or later, it will experience the old behavior, where Hierarchical is the default format. This default applies to platforms net45+, netstandard1.1+, and netcoreapp (1.x, 2.x, and 3.x). In .NET 5.0 and later, Activity.DefaultIdFormat is set to ActivityIdFormat.W3C.

Version introduced


If your application is agnostic to the identifier that's used for distributed tracing, no action is needed. Libraries such as ASP.NET Core and HttpClient can consume or propagate both versions of the ActivityIdFormat.

If you require interoperability with existing systems, or current systems rely on the format of the identifier, you can preserve the old behavior by setting DefaultIdFormat to ActivityIdFormat.Hierarchical. Alternatively, you can set an AppContext switch in one of three ways:

  • In the project file.

      <RuntimeHostConfigurationOption Include="System.Diagnostics.DefaultActivityIdFormatIsHierarchial" Value="true" />
  • In the runtimeconfig.json file.

        "runtimeOptions": {
            "configProperties": {
                "System.Diagnostics.DefaultActivityIdFormatIsHierarchial": true
  • Through an environment variable.


Affected APIs