Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Starting in .NET 8, if you create an Activity object using null for the operation name, the operation name will be stored as an empty string ("") instead of null.
Previous behavior
Previously, if you created an Activity object using a null operation name, the operation name inside the activity was stored as null.
new Activity(operationName: null).OperationName // Value is null.
New behavior
Starting in .NET 8, if you create an Activity object using a null operation name, the operation name is stored as an empty string.
new Activity(operationName: null).OperationName // Value is "".
Version introduced
.NET 8 Preview 1
Type of breaking change
This change is a behavioral change.
Reason for change
A null operation name in an Activity object can have an undesirable effect on backend trace collectors, which usually assume non-null operation names.
To avoid crashes, trace collectors have to special case null operation names inside an Activity object. This change removes the special case requirement.
Recommended action
This change is unlikely to cause breaks as using null when creating Activity objects is rare. If for any reason your code depended on the null value for the operation name, adjust the code to either not use null or expect that the operation name will be stored as an empty string when you specify null.