Skip to content

Commit f92fa73

Browse files
Copilotbaronfel
andcommitted
Use assembly version for ActivitySource instead of hardcoded version
Get version from AssemblyInformationalVersionAttribute with "1.0.0" as fallback Co-authored-by: baronfel <[email protected]>
1 parent a902e0e commit f92fa73

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Installer/Microsoft.Dotnet.Installation/Internal/InstallationActivitySource.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics;
5+
using System.Reflection;
56

67
namespace Microsoft.Dotnet.Installation.Internal;
78

89
internal static class InstallationActivitySource
910
{
10-
private static readonly ActivitySource s_activitySource = new("Microsoft.Dotnet.Installer", "1.0.0");
11+
private static readonly ActivitySource s_activitySource = new("Microsoft.Dotnet.Installer",
12+
typeof(InstallationActivitySource).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "1.0.0");
1113

1214
public static ActivitySource ActivitySource => s_activitySource;
1315
}

0 commit comments

Comments
 (0)