Skip to content

Commit 302ad90

Browse files
authored
Updated version of System.Diagnostics.DiagnosticSource to 4.6.0-preview7 (#1183)
Updated version of System.Diagnostics.DiagnosticSource to 4.6.0-preview7
1 parent 215f4a5 commit 302ad90

16 files changed

+35
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This changelog will be used to generate documentation on [release notes page](ht
77
- [Minor perf improvement by reading Actity.Tag only if required.](https://github.com/microsoft/ApplicationInsights-dotnet/pull/1170)
88
- [Fix: Channels not handling AggregateException, not logging full HttpRequestException.](https://github.com/microsoft/ApplicationInsights-dotnet/issues/1173)
99
- [Metric Aggregator background thread safeguards added to never throw unhandled exception.](https://github.com/microsoft/ApplicationInsights-dotnet/issues/1179)
10+
- [Updated version of System.Diagnostics.DiagnosticSource to 4.6.0-preview7.19362.9. Also remove marking SDK as CLS-Compliant](https://github.com/microsoft/ApplicationInsights-dotnet/pull/1183)
1011

1112
## Version 2.11.0-beta1
1213
- [Performance fixes: Support Head Sampling; Remove NewGuid(); Sampling Flags; etc... ](https://github.com/microsoft/ApplicationInsights-dotnet/pull/1158)

Test/Microsoft.ApplicationInsights.Test/Net45/Microsoft.ApplicationInsights.Net45.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
3232
<PackageReference Include="CompareNETObjects" Version="4.59.0" />
3333
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
34-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
34+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
3535
<PackageReference Include="Moq" Version="4.10.0" />
3636
<Reference Include="Microsoft.CSharp" />
3737
<Reference Include="System" />

Test/Microsoft.ApplicationInsights.Test/Net46/Microsoft.ApplicationInsights.Net46.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
3232
<PackageReference Include="CompareNETObjects" Version="4.59.0" />
3333
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
34-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
34+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
3535
<PackageReference Include="Moq" Version="4.10.0" />
3636
<Reference Include="Microsoft.CSharp" />
3737
<Reference Include="System" />

Test/Microsoft.ApplicationInsights.Test/Shared/Metrics/TelemetryConfigurationExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class TelemetryConfigurationExtensionsTests
2121
public void Metrics_DefaultPipeline()
2222
{
2323
TelemetryConfiguration defaultTelemetryPipeline = TelemetryConfiguration.Active;
24-
//using (defaultTelemetryPipeline)
24+
// using (defaultTelemetryPipeline)
2525
{
2626
Metrics_SpecifiedPipeline(defaultTelemetryPipeline);
2727
TestUtil.CompleteDefaultAggregationCycle(defaultTelemetryPipeline.GetMetricManager());

Test/Microsoft.ApplicationInsights.Test/Standalone/AppInsightsStandaloneTests.cs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using Microsoft.CodeAnalysis.CSharp;
88
using Microsoft.VisualStudio.TestTools.UnitTesting;
99
using System;
10+
using Microsoft.ApplicationInsights.Extensibility;
11+
using Microsoft.ApplicationInsights.DataContracts;
1012

1113
[TestClass]
1214
public class AppInsightsStandaloneTests
@@ -31,24 +33,32 @@ public void Cleanup()
3133
[TestMethod]
3234
public void AppInsightsDllCouldRunStandalone()
3335
{
34-
var dependencyId = RunTestApplication(false, "guid");
36+
// This tests if ApplicationInsights.dll can work standalone without System.DiagnosticSource (for uses like in a powershell script)
37+
// Its hard to mock this with plain unit tests, so we spin up a dummy application, copy just ApplicationInsights.dll
38+
// and run it.
39+
var dependencyId = RunTestApplication("guid");
3540
Assert.IsFalse(dependencyId.Contains("guid"));
3641
}
3742

3843
[TestMethod]
3944
public void AppInsightsUsesActivityWhenDiagnosticSourceIsAvailable()
4045
{
41-
var dependencyId = RunTestApplication(true, "guid");
42-
Assert.IsTrue(dependencyId.StartsWith("|guid."));
43-
}
44-
45-
private string RunTestApplication(bool withDiagnosticSource, string operationId)
46-
{
47-
if (withDiagnosticSource)
46+
// Regular use case - System.DiagnosticSource is available. Regular unit test can cover this scenario.
47+
var config = new TelemetryConfiguration();
48+
config.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
49+
var tc = new TelemetryClient(config);
50+
using (var requestOperation = tc.StartOperation<RequestTelemetry>("request", "guid"))
4851
{
49-
File.Copy("System.Diagnostics.DiagnosticSource.dll", $"{this.tempPath}\\System.Diagnostics.DiagnosticSource.dll");
52+
using (var dependencyOperation = tc.StartOperation<DependencyTelemetry>("dependency", "guid"))
53+
{
54+
Assert.IsTrue(dependencyOperation.Telemetry.Id.StartsWith("|guid."));
55+
tc.TrackTrace("Hello World!");
56+
}
5057
}
58+
}
5159

60+
private string RunTestApplication(string operationId)
61+
{
5262
var fileName = $"{this.tempPath}\\ActivityTest.exe";
5363

5464
Assert.IsTrue(CreateTestApplication(fileName));
@@ -68,7 +78,10 @@ private string RunTestApplication(bool withDiagnosticSource, string operationId)
6878
p.Start();
6979

7080
Assert.IsTrue(p.WaitForExit(10000));
81+
Trace.WriteLine(p.StandardOutput.ReadToEnd());
82+
Trace.WriteLine(p.StandardError.ReadToEnd());
7183
Assert.AreEqual(0, p.ExitCode);
84+
7285

7386
return p.StandardOutput.ReadToEnd();
7487
}

Test/Microsoft.ApplicationInsights.Test/Standalone/Microsoft.ApplicationInsights.Isolated.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<PackageReference Include="System.Collections.Immutable" Version="1.3.1" />
3737
<Reference Include="System.ComponentModel.Composition" />
3838
<PackageReference Include="System.Console" Version="4.3.0" />
39-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
39+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
4040
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
4141
<PackageReference Include="System.Diagnostics.StackTrace" Version="4.3.0" />
4242
<PackageReference Include="System.IO.Compression" Version="4.3.0" />

Test/Microsoft.ApplicationInsights.Test/netcoreapp11/Microsoft.ApplicationInsights.netcoreapp11.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
2626
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
2727
<PackageReference Include="CompareNETObjects" Version="4.59.0" />
28-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
28+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
2929
<PackageReference Include="System.Net.Http" Version="4.3.4" />
3030
<PackageReference Include="System.Net.Security" Version="4.3.2" />
3131
</ItemGroup>

Test/Microsoft.ApplicationInsights.Test/netcoreapp20/Microsoft.ApplicationInsights.netcoreapp20.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
2727
<PackageReference Include="CompareNETObjects" Version="4.59.0" />
2828
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
29-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
29+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
3030
</ItemGroup>
3131

3232
<ItemGroup>

Test/ServerTelemetryChannel.Test/Net45.Tests/TelemetryChannel.Net45.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
3232
<PackageReference Include="CompareNETObjects" Version="4.59.0" />
3333
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
34-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
34+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
3535
<ProjectReference Include="..\..\..\src\ServerTelemetryChannel\TelemetryChannel.csproj">
3636
<Project>{3273d899-d9b3-44fe-b3ab-578e18b2ef90}</Project>
3737
<Name>TelemetryChannel</Name>

Test/ServerTelemetryChannel.Test/NetCore.Tests/TelemetryChannel.netcoreapp11.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<PackageReference Include="System.Security.AccessControl" Version="4.3.0" />
3535
<PackageReference Include="CompareNETObjects" Version="4.59.0" />
3636
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
37-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
37+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
3838
<PackageReference Include="System.Net.Security" Version="4.3.2" />
3939
<ProjectReference Include="..\..\..\src\ServerTelemetryChannel\TelemetryChannel.csproj" />
4040
</ItemGroup>

0 commit comments

Comments
 (0)