Skip to content

Commit

Permalink
SDKVersion to hint NETCORE, other minor changes (#1125)
Browse files Browse the repository at this point in the history
* SDKVersion modified to be dotnetc for NetCore. This helps identify the source of code path, as implementations are slightly different for NetCore
  • Loading branch information
cijothomas authored May 2, 2019
1 parent 1a97e6b commit ca4b1eb
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This changelog will be used to generate documentation on [release notes page](http://azure.microsoft.com/documentation/articles/app-insights-release-notes-dotnet/).

## Version 2.10.0
- SDKVersion modified to be dotnetc for NetCore. This helps identify the source of code path, as implementations are slightly different for NetCore.

## Version 2.10.0-beta4
- [Fix NullReferenceException in DiagnosticsEventListener.OnEventWritten](https://github.com/Microsoft/ApplicationInsights-dotnet/issues/1106)
- [Fix RichPayloadEventSource can get enabled at Verbose level](https://github.com/Microsoft/ApplicationInsights-dotnet/issues/1108)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
![Build Status](https://mseng.visualstudio.com/DefaultCollection/_apis/public/build/definitions/96a62c4a-58c2-4dbb-94b6-5979ebc7f2af/1822/badge)
[![Build Status](https://mseng.visualstudio.com/AppInsights/_apis/build/status/ChuckNorris/AI-BaseSDK-develop-linux?branchName=develop)](https://mseng.visualstudio.com/AppInsights/_build/latest?definitionId=6237?branchName=develop)
[![Build Status](https://mseng.visualstudio.com/AppInsights/_apis/build/status/ChuckNorris/AI-BaseSDK-GitHub-Master?branchName=develop)](https://mseng.visualstudio.com/AppInsights/_build/latest?definitionId=1822?branchName=develop)
[![codecov.io](https://codecov.io/github/Microsoft/ApplicationInsights-dotnet/coverage.svg?branch=develop)](https://codecov.io/github/Microsoft/ApplicationInsights-dotnet?branch=develop)

## NuGet packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,11 @@ public static void ValidateSdkVersionString(string versionMoniker)
Assert.IsNotNull(versionMoniker);

// Expected result example: "m-agg2:2.6.0-12552"

#if NETCOREAPP1_1 || NETCOREAPP2_0
const string expectedPrefix = "m-agg2c:";
#else
const string expectedPrefix = "m-agg2:";
#endif

string sdkRevisionComponentStr = versionMoniker.Substring(expectedPrefix.Length);
string expectedVersion = SdkVersionUtils.GetSdkVersion(String.Empty);
Expand Down
2 changes: 1 addition & 1 deletion Test/TestFramework/Shared/EventSourceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static void VerifyEventMessage(MethodInfo eventMethod, EventWrittenEvent

private static void VerifyEventApplicationName(MethodInfo eventMethod, EventWrittenEventArgs actualEvent)
{
#if !NETCOREAPP
#if !NETCOREAPP1_1
string expectedApplicationName = AppDomain.CurrentDomain.FriendlyName;
#else
string expectedApplicationName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ internal class HeartbeatProvider : IDisposable, IHeartbeatProvider

/// <summary>
/// Value for property indicating 'app insights version' related specifically to heartbeats.
/// </summary>
/// </summary>
#if NETSTANDARD1_3 || NETSTANDARD2_0
private static string sdkVersionPropertyValue = SdkVersionUtils.GetSdkVersion("hbnetc:");
#else
private static string sdkVersionPropertyValue = SdkVersionUtils.GetSdkVersion("hbnet:");
#endif

/// <summary>
/// The name of the heartbeat metric item and operation context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ internal static class Util

private const string FallbackParameterName = "specified parameter";

#if NETSTANDARD1_3 || NETSTANDARD2_0
private static string sdkVersionMoniker = SdkVersionUtils.GetSdkVersion("m-agg2c:");
#else
private static string sdkVersionMoniker = SdkVersionUtils.GetSdkVersion("m-agg2:");
#endif

/// <summary>
/// Parameter check for Null.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net45;net46;netstandard1.3;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) != 'Windows_NT'">netstandard1.3</TargetFrameworks>
<TargetFrameworks Condition="$(OS) != 'Windows_NT'">netstandard1.3;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.ApplicationInsights/TelemetryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
/// </summary>
public sealed class TelemetryClient
{
#if NETSTANDARD1_3 || NETSTANDARD2_0
private const string VersionPrefix = "dotnetc:";
#else
private const string VersionPrefix = "dotnet:";
#endif
private readonly TelemetryConfiguration configuration;
private string sdkVersion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ private static string GetApplicationName()
string name;
try
{
#if !NETSTANDARD
#if !NETSTANDARD1_3
name = AppDomain.CurrentDomain.FriendlyName;
#else
name = string.Empty;
Expand Down

0 comments on commit ca4b1eb

Please sign in to comment.