diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 5196f20210..63c79d2779 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -21,11 +21,19 @@ To successfully build the sources on your machine, make sure you've installed th
- Visual Studio 2022 Community, Professional or Enterprise
- .NET SDKs (https://dotnet.microsoft.com/download)
- .NET Framework 4.5.2
+ - .NET Framework 4.6.0
+ - .NET Framework 4.6.1
- .NET Framework 4.6.2
- .NET Framework 4.7.2
- - .NET Framework 4.8
+ - .NET Framework 4.8.0
+ - .NET Framework 4.8.1
- .NET Core 3.1
- .NET 6
+ - .NET 7
+
+Note: .NET has an annual release cycle and we include the preview version in our test matrix.
+Visual Studio requires a setting to compile using these preview versions:
+ - Tools > Options > Environment > Preview Features > "Use previews of the .NET SDK".
## Build
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000000..4cff4d6f18
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,12 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ # Maintain dependencies for GitHub Actions
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
diff --git a/.github/workflows/build-and-test-BASE.yml b/.github/workflows/build-and-test-BASE.yml
index c1ac1246a7..e9ab04d502 100644
--- a/.github/workflows/build-and-test-BASE.yml
+++ b/.github/workflows/build-and-test-BASE.yml
@@ -24,13 +24,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
- framework: [net452, net462, net472, net480, netcoreapp3.1, net6.0]
+ framework: [net452, net462, net472, net480, net481, netcoreapp3.1, net6.0, net7.0]
include:
- os: ubuntu-latest
args: "--filter TestCategory!=WindowsOnly"
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v2
@@ -39,6 +39,11 @@ jobs:
3.1.x
6.0.x
+ - uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: '7.0.x'
+ include-prerelease: true
+
- name: Restore
run: dotnet restore ${{ env.SOLUTION }}
diff --git a/.github/workflows/build-and-test-LOGGING.yml b/.github/workflows/build-and-test-LOGGING.yml
index 79ba5d0a64..fe73e94889 100644
--- a/.github/workflows/build-and-test-LOGGING.yml
+++ b/.github/workflows/build-and-test-LOGGING.yml
@@ -24,10 +24,10 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
- framework: [net452, net462, net472, net480, netcoreapp3.1, net6.0]
+ framework: [net452, net462, net472, net480, net481, netcoreapp3.1, net6.0, net7.0]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v2
@@ -36,6 +36,11 @@ jobs:
3.1.x
6.0.x
+ - uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: '7.0.x'
+ include-prerelease: true
+
- name: Restore
run: dotnet restore ${{ env.SOLUTION }}
diff --git a/.github/workflows/build-and-test-NETCORE.yml b/.github/workflows/build-and-test-NETCORE.yml
index 1de041f3cd..d496d6f782 100644
--- a/.github/workflows/build-and-test-NETCORE.yml
+++ b/.github/workflows/build-and-test-NETCORE.yml
@@ -24,13 +24,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
- framework: [net452, net462, net472, net480, netcoreapp3.1, net6.0]
+ framework: [net452, net462, net472, net480, net481, netcoreapp3.1, net6.0, net7.0]
include:
- os: ubuntu-latest
args: "--filter TestCategory!=WindowsOnly"
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v2
@@ -39,6 +39,11 @@ jobs:
3.1.x
6.0.x
+ - uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: '7.0.x'
+ include-prerelease: true
+
- name: Restore
run: dotnet restore ${{ env.SOLUTION }}
diff --git a/.github/workflows/build-and-test-WEB.yml b/.github/workflows/build-and-test-WEB.yml
index 9e313a6b35..30c86e2a67 100644
--- a/.github/workflows/build-and-test-WEB.yml
+++ b/.github/workflows/build-and-test-WEB.yml
@@ -24,10 +24,10 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
- framework: [net452, net462, net472, net480, netcoreapp3.1, net6.0]
+ framework: [net452, net462, net472, net480, net481, netcoreapp3.1, net6.0, net7.0]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v2
@@ -36,6 +36,11 @@ jobs:
3.1.x
6.0.x
+ - uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: '7.0.x'
+ include-prerelease: true
+
- name: Restore
run: dotnet restore ${{ env.SOLUTION }}
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 5ffefecaf4..7f502b9180 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -22,7 +22,7 @@ jobs:
solution: [./ProjectsForSigning.sln]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}
diff --git a/.github/workflows/redfield-sanity-check.yml b/.github/workflows/redfield-sanity-check.yml
index 7dfbf9260c..80bf6e1918 100644
--- a/.github/workflows/redfield-sanity-check.yml
+++ b/.github/workflows/redfield-sanity-check.yml
@@ -24,13 +24,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
- framework: [netcoreapp3.1,net6.0]
+ framework: [netcoreapp3.1,net6.0,net7.0]
include:
- os: ubuntu-latest
args: "--filter TestCategory!=WindowsOnly"
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v2
@@ -39,6 +39,11 @@ jobs:
3.1.x
6.0.x
+ - uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: '7.0.x'
+ include-prerelease: true
+
- name: Restore
run: dotnet restore ${{ env.SOLUTION }}
diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml
index 366f01cfd4..2592175666 100644
--- a/.github/workflows/sanity.yml
+++ b/.github/workflows/sanity.yml
@@ -29,7 +29,7 @@ jobs:
./WEB/Src/Microsoft.ApplicationInsights.Web.sln]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v2
@@ -38,6 +38,11 @@ jobs:
3.1.x
6.0.x
+ - uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: '7.0.x'
+ include-prerelease: true
+
- name: Restore
run: dotnet restore ${{ matrix.solution }}
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index c61831781f..c5b64f2c2a 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -12,7 +12,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- - uses: actions/stale@v4.0.0
+ - uses: actions/stale@v6.0.0
id: stale
with:
stale-issue-message: 'This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.'
diff --git a/.gitignore b/.gitignore
index 1ba2c8282d..4e569cda5a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,6 +65,10 @@ ipch/
*.vsp
*.vspx
+# Visual Studio live unit testing config
+*.lutconfig
+*.lutignore
+
# Guidance Automation Toolkit
*.gpState
diff --git a/.props/Test.props b/.props/Test.props
index 9ec8bcf889..c075526ee7 100644
--- a/.props/Test.props
+++ b/.props/Test.props
@@ -16,10 +16,11 @@
- net4.7.2
- net4.8.0
- netcoreapp3.1 (EoL Dec 2022)
- - net6.0 (GA Nov 2021)
+ - net6.0 (EoL Nov 2024)
+ - net7.0 (GA Nov 2022)
-->
- net462;net472;net480;netcoreapp3.1;net6.0
- netcoreapp3.1;net6.0
+ net462;net472;net480;net481;netcoreapp3.1;net6.0;net7.0
+ netcoreapp3.1;net6.0;net7.0
diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/ExceptionTelemetryTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/ExceptionTelemetryTest.cs
index eba8dbbf0c..5a2e39b1c4 100644
--- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/ExceptionTelemetryTest.cs
+++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/ExceptionTelemetryTest.cs
@@ -265,6 +265,30 @@ public void ExceptionPropertySetterReplacesExceptionDetailsInExceptionsCollectio
Assert.AreEqual(nextException.Message, testExceptionTelemetry.ExceptionDetailsInfoList.First().Message);
}
+ [TestMethod]
+ public void ExceptionPropertySetterPreservesContext()
+ {
+ // ARRANGE
+ Exception constructorException = new Exception("ConstructorException");
+ var testExceptionTelemetry = new ExceptionTelemetry(constructorException);
+
+ const string expectedAccountId = "AccountId";
+ testExceptionTelemetry.Context.User.AccountId = expectedAccountId;
+ const string expectedAuthenticatedUserId = "AuthUserId";
+ testExceptionTelemetry.Context.User.AuthenticatedUserId = expectedAuthenticatedUserId;
+ const string expectedUserAgent = "ExceptionComponent";
+ testExceptionTelemetry.Context.User.UserAgent = expectedUserAgent;
+
+ // ACT
+ Exception nextException = new Exception("NextException");
+ testExceptionTelemetry.Exception = nextException;
+
+ // ASSERT
+ Assert.AreEqual(expectedAccountId, testExceptionTelemetry.Context.User.AccountId);
+ Assert.AreEqual(expectedAuthenticatedUserId, testExceptionTelemetry.Context.User.AuthenticatedUserId);
+ Assert.AreEqual(expectedUserAgent, testExceptionTelemetry.Context.User.UserAgent);
+ }
+
#pragma warning disable 618
[TestMethod]
public void HandledAtReturnsUnhandledByDefault()
diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs
index 93227d842a..d54804996d 100644
--- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs
+++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs
@@ -1150,7 +1150,11 @@ public void LoadPropertiesGivesPrecedenceToValuesFromElementsBecauseTheyAppearBe
}
[TestMethod]
+#if NET7_0_OR_GREATER
+ [ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'IntegerProperty' Reason: The input string '123a' was not in a correct format.")]
+#else
[ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'IntegerProperty' Reason: Input string was not in a correct format.")]
+#endif
public void LoadPropertiesThrowsExceptionWithPropertyName()
{
// parsing this integer will throw "System.FormatException: Input string was not in a correct format."
@@ -1167,7 +1171,11 @@ public void LoadPropertiesThrowsExceptionWithPropertyName()
}
[TestMethod]
+#if NET7_0_OR_GREATER
+ [ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'IntegerProperty' Reason: The input string '123a' was not in a correct format.")]
+#else
[ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'IntegerProperty' Reason: Input string was not in a correct format.")]
+#endif
public void LoadProperties_TelemetryClientThrowsException()
{
string testConfig = Configuration(
diff --git a/BASE/Test/TestFramework/Shared/EventSourceTest.cs b/BASE/Test/TestFramework/Shared/EventSourceTest.cs
index 7814127651..4c7a280590 100644
--- a/BASE/Test/TestFramework/Shared/EventSourceTest.cs
+++ b/BASE/Test/TestFramework/Shared/EventSourceTest.cs
@@ -27,10 +27,24 @@ private static void VerifyMethodImplementation(EventSource eventSource, MethodIn
listener.EnableEvents(eventSource, EventLevel.Verbose, (EventKeywords)AllKeywords);
try
{
+ var guid = Guid.NewGuid();
+ EventSource.SetCurrentThreadActivityId(guid);
+
object[] eventArguments = GenerateEventArguments(eventMethod);
eventMethod.Invoke(eventSource, eventArguments);
- EventWrittenEventArgs actualEvent = listener.Messages.First();
+ EventWrittenEventArgs actualEvent = listener.Messages.FirstOrDefault(x => x.ActivityId == guid);
+
+ if (actualEvent == null)
+ {
+ throw new Exception("Listener failed to collect event.");
+ }
+ else if (actualEvent.EventId == 0)
+ {
+ // an error occurred
+ throw new Exception(actualEvent.Message);
+ }
+
VerifyEventId(eventMethod, actualEvent);
VerifyEventLevel(eventMethod, actualEvent);
VerifyEventMessage(eventMethod, actualEvent, eventArguments);
diff --git a/BASE/src/Microsoft.ApplicationInsights/DataContracts/ExceptionTelemetry.cs b/BASE/src/Microsoft.ApplicationInsights/DataContracts/ExceptionTelemetry.cs
index 68bb6ee63c..8bffa80d91 100644
--- a/BASE/src/Microsoft.ApplicationInsights/DataContracts/ExceptionTelemetry.cs
+++ b/BASE/src/Microsoft.ApplicationInsights/DataContracts/ExceptionTelemetry.cs
@@ -449,7 +449,15 @@ private void UpdateData(Exception exception)
this.Data = new ExceptionInfo(exceptions.Select(ex => new ExceptionDetailsInfo(ex)), this.SeverityLevel,
this.ProblemId, this.Properties, this.Metrics);
- this.context = new TelemetryContext(this.Data.Properties);
+
+ if (this.context == null)
+ {
+ this.context = new TelemetryContext(this.Data.Properties);
+ }
+ else
+ {
+ this.context = this.context.DeepClone(this.Data.Properties);
+ }
}
catch (Exception ex)
{
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 276ee864bb..3d50241877 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,10 @@
# Changelog
## VNext
-
+- Update endpoint redirect header name for QuickPulse module to v2
- AzureSdkDiagnosticListener modified to use sdkversion prefix "rdddsaz" instead of "dotnet".
+- [ILogger logs with LogLevel.None severity are now ignored by ApplicationInsightsLogger](https://github.com/microsoft/ApplicationInsights-dotnet/pull/2667). Fixes ([#2666](https://github.com/microsoft/ApplicationInsights-dotnet/issues/2666))
+- [Fix ExceptionTelemetry clears all Context when updating Exception property](https://github.com/microsoft/ApplicationInsights-dotnet/issues/2086)
## Version 2.21.0
- no changes since beta.
diff --git a/Directory.Build.props b/Directory.Build.props
index e365a51256..58e3e9f31c 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -81,9 +81,9 @@
preview
- True
- True
- True
+ True
+ True
+ True