Skip to content

Commit

Permalink
[Core] Upgrading dependency on System.Diagnostics.DiagnosticSource (#…
Browse files Browse the repository at this point in the history
…37418)

* test

* fix

* remove deprecated reference version

* DO NOT MERGE

* feedback

* reverting file

* removing extra newline

* fix
  • Loading branch information
m-redding authored Jul 7, 2023
1 parent 0a0ba46 commit 8f4b156
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<PackageReference Update="System.Memory.Data" Version="1.0.2" />
<PackageReference Update="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Update="System.Net.Http" Version="4.3.4" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="4.6.0" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
<PackageReference Update="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageReference Update="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Update="System.Threading.Tasks.Extensions" Version="4.5.4" />
Expand Down
9 changes: 7 additions & 2 deletions sdk/core/Azure.Core/src/Azure.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>This is the implementation of the Azure Client Pipeline</Description>
<AssemblyTitle>Microsoft Azure Client Pipeline</AssemblyTitle>
Expand All @@ -25,14 +25,19 @@

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="System.Numerics.Vectors" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="System.Threading.Tasks.Extensions" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="System.Memory.Data" />
</ItemGroup>

<!-- Keep System.Diagnostics.DiagnosticSource 4.6.0 for netcoreapp2.1 support. -->
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
<PackageReference Include="System.Diagnostics.DiagnosticSource" VersionOverride="4.6.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<PackageReference Include="System.Net.Http" />
Expand Down
6 changes: 3 additions & 3 deletions sdk/core/Azure.Core/src/Shared/MessagingClientDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ public void InstrumentMessage(IDictionary<string, object> properties, string act
DiagnosticScope.ActivityKind.Producer);
messageScope.Start();

Activity activity = Activity.Current;
Activity? activity = Activity.Current;
if (activity != null)
{
traceparent = activity.Id;
traceparent = activity.Id!;
properties[DiagnosticIdAttribute] = traceparent;
if (ActivityExtensions.SupportsActivitySource())
{
Expand All @@ -192,4 +192,4 @@ public void InstrumentMessage(IDictionary<string, object> properties, string act
}
}
}
}
}

0 comments on commit 8f4b156

Please sign in to comment.