Skip to content

Commit 8f4b156

Browse files
authored
[Core] Upgrading dependency on System.Diagnostics.DiagnosticSource (Azure#37418)
* test * fix * remove deprecated reference version * DO NOT MERGE * feedback * reverting file * removing extra newline * fix
1 parent 0a0ba46 commit 8f4b156

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<PackageReference Update="System.Memory.Data" Version="1.0.2" />
6969
<PackageReference Update="System.Numerics.Vectors" Version="4.5.0" />
7070
<PackageReference Update="System.Net.Http" Version="4.3.4" />
71-
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="4.6.0" />
71+
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
7272
<PackageReference Update="System.Reflection.TypeExtensions" Version="4.7.0" />
7373
<PackageReference Update="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
7474
<PackageReference Update="System.Threading.Tasks.Extensions" Version="4.5.4" />

sdk/core/Azure.Core/src/Azure.Core.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>This is the implementation of the Azure Client Pipeline</Description>
44
<AssemblyTitle>Microsoft Azure Client Pipeline</AssemblyTitle>
@@ -25,14 +25,19 @@
2525

2626
<ItemGroup>
2727
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
28-
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
2928
<PackageReference Include="System.Numerics.Vectors" />
29+
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
3030
<PackageReference Include="System.Threading.Tasks.Extensions" />
3131
<PackageReference Include="System.Text.Json" />
3232
<PackageReference Include="System.Text.Encodings.Web" />
3333
<PackageReference Include="System.Memory.Data" />
3434
</ItemGroup>
3535

36+
<!-- Keep System.Diagnostics.DiagnosticSource 4.6.0 for netcoreapp2.1 support. -->
37+
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
38+
<PackageReference Include="System.Diagnostics.DiagnosticSource" VersionOverride="4.6.0" />
39+
</ItemGroup>
40+
3641
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
3742
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
3843
<PackageReference Include="System.Net.Http" />

sdk/core/Azure.Core/src/Shared/MessagingClientDiagnostics.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ public void InstrumentMessage(IDictionary<string, object> properties, string act
170170
DiagnosticScope.ActivityKind.Producer);
171171
messageScope.Start();
172172

173-
Activity activity = Activity.Current;
173+
Activity? activity = Activity.Current;
174174
if (activity != null)
175175
{
176-
traceparent = activity.Id;
176+
traceparent = activity.Id!;
177177
properties[DiagnosticIdAttribute] = traceparent;
178178
if (ActivityExtensions.SupportsActivitySource())
179179
{
@@ -192,4 +192,4 @@ public void InstrumentMessage(IDictionary<string, object> properties, string act
192192
}
193193
}
194194
}
195-
}
195+
}

0 commit comments

Comments
 (0)