From b22155fc964dbbdd852636ee9b2854558e28b455 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 21 Jan 2025 09:17:27 +1300 Subject: [PATCH 01/11] Workaround flaky SSL connection installing Android SDKs (#3904) --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0947f636db..187de670ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -220,10 +220,17 @@ jobs: uses: ./.github/actions/buildnative - name: Install Android SDKs + id: installandroidsdks + continue-on-error: true if: runner.os == 'macOS' run: | dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/" + - name: Install Android SDKs (retry) + if: steps.installandroidsdks.outcome=='failure' && runner.os == 'macOS' + run: | + dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/" + - name: Publish Test app (macOS) run: dotnet publish test/Sentry.TrimTest/Sentry.TrimTest.csproj -c Release -r osx-arm64 From 3e4af3007eeba086c03a049511b38b1404be8d9c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:52:03 +1300 Subject: [PATCH 02/11] chore: update scripts/update-java.ps1 to 7.20.1 (#3907) Co-authored-by: GitHub --- CHANGELOG.md | 3 +++ src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf2cf291e5..f47b834bdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ - Bump Native SDK from v0.7.17 to v0.7.18 ([#3891](https://github.com/getsentry/sentry-dotnet/pull/3891)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0718) - [diff](https://github.com/getsentry/sentry-native/compare/0.7.17...0.7.18) +- Bump Java SDK from v7.20.0 to v7.20.1 ([#3907](https://github.com/getsentry/sentry-dotnet/pull/3907)) + - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7201) + - [diff](https://github.com/getsentry/sentry-java/compare/7.20.0...7.20.1) ## 5.0.1 diff --git a/src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj b/src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj index 46cc0077ab..b9aec99266 100644 --- a/src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj +++ b/src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj @@ -3,7 +3,7 @@ net8.0-android34.0 $(NoWarn);BG8605;BG8606 - 7.20.0 + 7.20.1 $(BaseIntermediateOutputPath)sdks\Sentry\Android\$(SentryAndroidSdkVersion)\ .NET Bindings for the Sentry Android SDK From dfd3f2de7bb48c17f16c5828b30960ac35cabefe Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Thu, 23 Jan 2025 01:49:03 +0100 Subject: [PATCH 03/11] chore: Increase date range for MIT licence (#3914) It's 2025 now. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 63e0ed9e4d..a7f4292ba5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2024 Sentry +Copyright (c) 2018-2025 Sentry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 8348561a168fa41b824d8b71367e039f56b8f6cf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:53:10 +1300 Subject: [PATCH 04/11] chore: update scripts/update-cli.ps1 to 2.41.1 (#3910) Co-authored-by: GitHub --- CHANGELOG.md | 3 +++ Directory.Build.props | 2 +- src/Sentry/Sentry.csproj | 14 +++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f47b834bdc..ed29453183 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ - Bump Java SDK from v7.20.0 to v7.20.1 ([#3907](https://github.com/getsentry/sentry-dotnet/pull/3907)) - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7201) - [diff](https://github.com/getsentry/sentry-java/compare/7.20.0...7.20.1) +- Bump CLI from v2.40.0 to v2.41.1 ([#3910](https://github.com/getsentry/sentry-dotnet/pull/3910)) + - [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2411) + - [diff](https://github.com/getsentry/sentry-cli/compare/2.40.0...2.41.1) ## 5.0.1 diff --git a/Directory.Build.props b/Directory.Build.props index b9a20c6d18..4cc66fb411 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -83,7 +83,7 @@ - 2.40.0 + 2.41.1 $(MSBuildThisFileDirectory)tools\sentry-cli\$(SentryCLIVersion)\ diff --git a/src/Sentry/Sentry.csproj b/src/Sentry/Sentry.csproj index 9a6d9a3afc..2a12b41a38 100644 --- a/src/Sentry/Sentry.csproj +++ b/src/Sentry/Sentry.csproj @@ -120,13 +120,13 @@ <_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) - - - - - - - + + + + + + + From b6ee85db678cdbe1b5340bd8ae00aca82dcc4419 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:53:55 +1300 Subject: [PATCH 05/11] chore: update modules/sentry-native to 0.7.19 (#3908) Co-authored-by: GitHub --- CHANGELOG.md | 6 +++--- modules/sentry-native | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed29453183..6354eb4f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,9 @@ ### Dependencies -- Bump Native SDK from v0.7.17 to v0.7.18 ([#3891](https://github.com/getsentry/sentry-dotnet/pull/3891)) - - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0718) - - [diff](https://github.com/getsentry/sentry-native/compare/0.7.17...0.7.18) +- Bump Native SDK from v0.7.17 to v0.7.19 ([#3891](https://github.com/getsentry/sentry-dotnet/pull/3891), [#3908](https://github.com/getsentry/sentry-dotnet/pull/3908)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0719) + - [diff](https://github.com/getsentry/sentry-native/compare/0.7.17...0.7.19) - Bump Java SDK from v7.20.0 to v7.20.1 ([#3907](https://github.com/getsentry/sentry-dotnet/pull/3907)) - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7201) - [diff](https://github.com/getsentry/sentry-java/compare/7.20.0...7.20.1) diff --git a/modules/sentry-native b/modules/sentry-native index 52ee37c24c..62b966c487 160000 --- a/modules/sentry-native +++ b/modules/sentry-native @@ -1 +1 @@ -Subproject commit 52ee37c24c1ec5a6f24aa8a5057bc6273f2e1162 +Subproject commit 62b966c487f08773dc23cfb17b991bdd3f170ae4 From 2b8ff9ec4da4b1e62f81fdcb1d1ad06342836fe3 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Thu, 23 Jan 2025 22:20:23 +0100 Subject: [PATCH 06/11] Remove date range for LICENSE (#3916) In our internal Open Source Legal Policy, we decided that licenses don't require a data range. This also has the advantage of not updating the date range yearly. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index a7f4292ba5..3b3d6e5e27 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2025 Sentry +Copyright (c) 2018 Sentry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From aa2caa1de05ccfe3d849acf55fa597d6c3ea1be8 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos <6349682+vaind@users.noreply.github.com> Date: Tue, 28 Jan 2025 01:57:04 +0100 Subject: [PATCH 07/11] chore: fixup solution file (#3913) --- Sentry.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sentry.sln b/Sentry.sln index 62290abdc9..3ef6fd24aa 100644 --- a/Sentry.sln +++ b/Sentry.sln @@ -170,7 +170,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Hangfire", "src\Sent EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Hangfire.Tests", "test\Sentry.Hangfire.Tests\Sentry.Hangfire.Tests.csproj", "{46E40BE8-1AB0-4846-B0A2-A40AD0272C64}" EndProject -Project("{00000000-0000-0000-0000-000000000000}") = "Sentry.Samples.AspNetCore.WebAPI.Profiling", "samples\Sentry.Samples.AspNetCore.WebAPI.Profiling\Sentry.Samples.AspNetCore.WebAPI.Profiling.csproj", "{A5B26C14-7313-4EDC-91E3-287F9374AB75}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.AspNetCore.WebAPI.Profiling", "samples\Sentry.Samples.AspNetCore.WebAPI.Profiling\Sentry.Samples.AspNetCore.WebAPI.Profiling.csproj", "{A5B26C14-7313-4EDC-91E3-287F9374AB75}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{233D34AB-970E-4913-AA1E-172E833FB5B2}" ProjectSection(SolutionItems) = preProject From b31e4db47bab1bf8433118c42ecd23a473d5025e Mon Sep 17 00:00:00 2001 From: Stefan Jandl Date: Tue, 28 Jan 2025 02:02:12 +0100 Subject: [PATCH 08/11] fix: Guard `user.IpAddress = "{{ auto }}"` by `SendDefaultPii` (#3893) Co-authored-by: James Crosswell --- CHANGELOG.md | 4 ++++ src/Sentry/Internal/Enricher.cs | 10 +++++++--- ...bIntegrationTests.Versioning.DotNet8_0.verified.txt | 3 +-- ...bIntegrationTests.Versioning.DotNet9_0.verified.txt | 3 +-- ...qlListenerTests.LoggingAsync.DotNet8_0.verified.txt | 3 +-- ...qlListenerTests.LoggingAsync.DotNet9_0.verified.txt | 3 +-- ...ListenerTests.RecordsEfAsync.DotNet8_0.verified.txt | 6 ++---- ...ListenerTests.RecordsEfAsync.DotNet9_0.verified.txt | 6 ++---- ...SqlListenerTests.RecordsEfAsync.Net4_8.verified.txt | 6 ++---- .../SqlListenerTests.RecordsSqlAsync.verified.txt | 6 ++---- .../IntegrationTests.Simple.verified.txt | 6 ++---- ...Tests.LoggingInsideTheContextOfLogging.verified.txt | 6 ++---- .../IntegrationTests.Simple.verified.txt | 3 +-- ...Tests.LoggingInsideTheContextOfLogging.verified.txt | 3 +-- ...Tests.LoggingInsideTheContextOfLogging.verified.txt | 3 +-- .../EventProcessorTests.Simple.verified.txt | 3 +-- .../EventProcessorTests.WithTransaction.verified.txt | 3 +-- ...ionTransactionEndedAsCrashed.DotNet8_0.verified.txt | 6 ++---- ...ionTransactionEndedAsCrashed.DotNet9_0.verified.txt | 6 ++---- ...eptionTransactionEndedAsCrashed.Net4_8.verified.txt | 6 ++---- .../Internals/MainSentryEventProcessorTests.cs | 4 ++-- .../TransactionProcessorTests.Discard.verified.txt | 3 +-- .../TransactionProcessorTests.Simple.verified.txt | 6 ++---- 23 files changed, 43 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6354eb4f46..9426f0ec6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Significant change in behavior + +- The User.IpAddress is now only set to `{{auto}}` when `SendDefaultPii` is enabled. This change gives you control over IP address collection directly on the client ([#3893](https://github.com/getsentry/sentry-dotnet/pull/3893)) + ### Features - .NET on iOS: Add experimental EnableAppHangTrackingV2 configuration flag to the options binding SDK ([#3877](https://github.com/getsentry/sentry-dotnet/pull/3877)) diff --git a/src/Sentry/Internal/Enricher.cs b/src/Sentry/Internal/Enricher.cs index df28a50e32..54829dca86 100644 --- a/src/Sentry/Internal/Enricher.cs +++ b/src/Sentry/Internal/Enricher.cs @@ -76,12 +76,16 @@ public void Apply(IEventLike eventLike) // User // Report local user if opt-in PII, no user was already set to event and feature not opted-out: - if (_options is { SendDefaultPii: true, IsEnvironmentUser: true } && !eventLike.HasUser()) + if (_options.SendDefaultPii) { - eventLike.User.Username = Environment.UserName; + if (_options.IsEnvironmentUser && !eventLike.HasUser()) + { + eventLike.User.Username = Environment.UserName; + } + + eventLike.User.IpAddress ??= DefaultIpAddress; } eventLike.User.Id ??= _options.InstallationId; - eventLike.User.IpAddress ??= DefaultIpAddress; //Apply App startup and Boot time eventLike.Contexts.App.StartTime ??= ProcessInfo.Instance?.StartupTime; diff --git a/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet8_0.verified.txt b/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet8_0.verified.txt index a75596e368..f60140240c 100644 --- a/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet8_0.verified.txt +++ b/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet8_0.verified.txt @@ -26,8 +26,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production, Breadcrumbs: [ diff --git a/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet9_0.verified.txt b/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet9_0.verified.txt index a75596e368..f60140240c 100644 --- a/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet9_0.verified.txt +++ b/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.DotNet9_0.verified.txt @@ -26,8 +26,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production, Breadcrumbs: [ diff --git a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet8_0.verified.txt b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet8_0.verified.txt index 2eebc2dae0..298823718c 100644 --- a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet8_0.verified.txt +++ b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet8_0.verified.txt @@ -18,8 +18,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Spans: [ { diff --git a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet9_0.verified.txt b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet9_0.verified.txt index 2eebc2dae0..298823718c 100644 --- a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet9_0.verified.txt +++ b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.LoggingAsync.DotNet9_0.verified.txt @@ -18,8 +18,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Spans: [ { diff --git a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet8_0.verified.txt b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet8_0.verified.txt index 5c1985dbc1..aa6dedca8c 100644 --- a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet8_0.verified.txt +++ b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet8_0.verified.txt @@ -22,8 +22,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 } } }, @@ -46,8 +45,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Breadcrumbs: [ { diff --git a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet9_0.verified.txt b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet9_0.verified.txt index 5c1985dbc1..aa6dedca8c 100644 --- a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet9_0.verified.txt +++ b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.DotNet9_0.verified.txt @@ -22,8 +22,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 } } }, @@ -46,8 +45,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Breadcrumbs: [ { diff --git a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.Net4_8.verified.txt b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.Net4_8.verified.txt index ce2f1f8ffa..96826b04ae 100644 --- a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.Net4_8.verified.txt +++ b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsEfAsync.Net4_8.verified.txt @@ -22,8 +22,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 } } }, @@ -46,8 +45,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Breadcrumbs: [ { diff --git a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsSqlAsync.verified.txt b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsSqlAsync.verified.txt index 37f2475d22..7d7654f67d 100644 --- a/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsSqlAsync.verified.txt +++ b/test/Sentry.DiagnosticSource.IntegrationTests/SqlListenerTests.RecordsSqlAsync.verified.txt @@ -22,8 +22,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 } } }, @@ -46,8 +45,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Breadcrumbs: [ { diff --git a/test/Sentry.EntityFramework.Tests/IntegrationTests.Simple.verified.txt b/test/Sentry.EntityFramework.Tests/IntegrationTests.Simple.verified.txt index bc260895fb..e24261c17c 100644 --- a/test/Sentry.EntityFramework.Tests/IntegrationTests.Simple.verified.txt +++ b/test/Sentry.EntityFramework.Tests/IntegrationTests.Simple.verified.txt @@ -22,8 +22,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production } @@ -47,8 +46,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production, Breadcrumbs: [ diff --git a/test/Sentry.Log4Net.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt b/test/Sentry.Log4Net.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt index 92bf1b5798..35fe2365e2 100644 --- a/test/Sentry.Log4Net.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt +++ b/test/Sentry.Log4Net.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt @@ -33,8 +33,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } @@ -75,8 +74,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } diff --git a/test/Sentry.Log4Net.Tests/IntegrationTests.Simple.verified.txt b/test/Sentry.Log4Net.Tests/IntegrationTests.Simple.verified.txt index 65415cde47..4ec1830811 100644 --- a/test/Sentry.Log4Net.Tests/IntegrationTests.Simple.verified.txt +++ b/test/Sentry.Log4Net.Tests/IntegrationTests.Simple.verified.txt @@ -32,8 +32,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } diff --git a/test/Sentry.NLog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt b/test/Sentry.NLog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt index d333fa1efb..016d53f540 100644 --- a/test/Sentry.NLog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt +++ b/test/Sentry.NLog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt @@ -40,8 +40,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } diff --git a/test/Sentry.Serilog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt b/test/Sentry.Serilog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt index c5df4578af..d917dd9d91 100644 --- a/test/Sentry.Serilog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt +++ b/test/Sentry.Serilog.Tests/IntegrationTests.LoggingInsideTheContextOfLogging.verified.txt @@ -39,8 +39,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } diff --git a/test/Sentry.Tests/EventProcessorTests.Simple.verified.txt b/test/Sentry.Tests/EventProcessorTests.Simple.verified.txt index f4d20928c3..b63e99dd53 100644 --- a/test/Sentry.Tests/EventProcessorTests.Simple.verified.txt +++ b/test/Sentry.Tests/EventProcessorTests.Simple.verified.txt @@ -32,8 +32,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } diff --git a/test/Sentry.Tests/EventProcessorTests.WithTransaction.verified.txt b/test/Sentry.Tests/EventProcessorTests.WithTransaction.verified.txt index 798424284e..af9d84138f 100644 --- a/test/Sentry.Tests/EventProcessorTests.WithTransaction.verified.txt +++ b/test/Sentry.Tests/EventProcessorTests.WithTransaction.verified.txt @@ -36,8 +36,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } diff --git a/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet8_0.verified.txt b/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet8_0.verified.txt index e2f6a68211..34439cfbcc 100644 --- a/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet8_0.verified.txt @@ -112,8 +112,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production } @@ -177,8 +176,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production, IsFinished: true diff --git a/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet9_0.verified.txt b/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet9_0.verified.txt index e2f6a68211..34439cfbcc 100644 --- a/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.DotNet9_0.verified.txt @@ -112,8 +112,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production } @@ -177,8 +176,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production, IsFinished: true diff --git a/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.Net4_8.verified.txt b/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.Net4_8.verified.txt index 800647416d..b453712534 100644 --- a/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.Net4_8.verified.txt +++ b/test/Sentry.Tests/HubTests.CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEndedAsCrashed.Net4_8.verified.txt @@ -112,8 +112,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production } @@ -177,8 +176,7 @@ } }, User: { - Id: Guid_1, - IpAddress: {{auto}} + Id: Guid_1 }, Environment: production, IsFinished: true diff --git a/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs b/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs index 26956f6ad3..a34d28625f 100644 --- a/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs +++ b/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs @@ -132,7 +132,7 @@ public void Process_SendDefaultPiiTrueAndUserIpSet_UserIpIgnoreServerInferredIp( } [Fact] - public void Process_SendDefaultPiiFalse_UserIpAuto() + public void Process_SendDefaultPiiFalse_UserIpUserIpNotSet() { //Arrange var evt = new SentryEvent(); @@ -143,7 +143,7 @@ public void Process_SendDefaultPiiFalse_UserIpAuto() _ = sut.Process(evt); //Assert - evt.User.IpAddress.Should().Be(Enricher.DefaultIpAddress); + evt.User.IpAddress.Should().Be(null); } [Fact] diff --git a/test/Sentry.Tests/TransactionProcessorTests.Discard.verified.txt b/test/Sentry.Tests/TransactionProcessorTests.Discard.verified.txt index 75f069a373..6ffc1f77f4 100644 --- a/test/Sentry.Tests/TransactionProcessorTests.Discard.verified.txt +++ b/test/Sentry.Tests/TransactionProcessorTests.Discard.verified.txt @@ -35,8 +35,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } diff --git a/test/Sentry.Tests/TransactionProcessorTests.Simple.verified.txt b/test/Sentry.Tests/TransactionProcessorTests.Simple.verified.txt index e97eedb4cd..b8a5f7a62b 100644 --- a/test/Sentry.Tests/TransactionProcessorTests.Simple.verified.txt +++ b/test/Sentry.Tests/TransactionProcessorTests.Simple.verified.txt @@ -35,8 +35,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production } @@ -85,8 +84,7 @@ } }, User: { - Id: Guid_3, - IpAddress: {{auto}} + Id: Guid_3 }, Environment: production, IsFinished: true From 6b75631f99ee9e0791318b47c606766db7d95e1f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:17:53 +1300 Subject: [PATCH 09/11] build(deps): bump github/codeql-action from 3.28.1 to 3.28.5 (#3918) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.1 to 3.28.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/b6a472f63d85b9c78a3ac5e89422239fc15e9b3c...f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index acc9055ab3..843fc886c4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,7 +35,7 @@ jobs: uses: ./.github/actions/environment - name: Initialize CodeQL - uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # pin@v2 + uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # pin@v2 with: languages: csharp @@ -49,6 +49,6 @@ jobs: run: dotnet build Sentry-CI-CodeQL.slnf --no-restore --nologo - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # pin@v2 + uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # pin@v2 with: category: '/language:csharp' From a4fc2fe7304ae3aaa79006d507b0c5e8f9b67bfc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:18:23 +1300 Subject: [PATCH 10/11] build(deps): bump codecov/codecov-action from 5.1.2 to 5.3.1 (#3919) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.3.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/1e68e06f1dbfde0e4cefc87efeba9e4643565303...13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 187de670ef..04bbd7a4a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,7 +123,7 @@ jobs: run: dotnet test Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage" - name: Upload code coverage - uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 - name: Upload build and test outputs if: failure() From 81452c164d25925f4e796849f844e46ea9d3adfc Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 28 Jan 2025 16:46:30 +1300 Subject: [PATCH 11/11] Fixed duplicate SentryMauiEventProcessors (#3905) --- CHANGELOG.md | 4 ++++ .../Internal/SentryMauiOptionsSetup.cs | 2 +- .../SentryMauiAppBuilderExtensions.cs | 3 --- .../SentryMauiAppBuilderExtensionsTests.cs | 19 +++++++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9426f0ec6b..ae68fdbfdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - .NET on iOS: Add experimental EnableAppHangTrackingV2 configuration flag to the options binding SDK ([#3877](https://github.com/getsentry/sentry-dotnet/pull/3877)) - Added `SentryOptions.DisableSentryHttpMessageHandler`. Useful if you're using `OpenTelemetry.Instrumentation.Http` and ending up with duplicate spans. ([#3879](https://github.com/getsentry/sentry-dotnet/pull/3879)) +### Fixes + +- Fixed duplicate SentryMauiEventProcessors ([#3905](https://github.com/getsentry/sentry-dotnet/pull/3905)) + ### Dependencies - Bump Native SDK from v0.7.17 to v0.7.19 ([#3891](https://github.com/getsentry/sentry-dotnet/pull/3891), [#3908](https://github.com/getsentry/sentry-dotnet/pull/3908)) diff --git a/src/Sentry.Maui/Internal/SentryMauiOptionsSetup.cs b/src/Sentry.Maui/Internal/SentryMauiOptionsSetup.cs index d13b9731d8..7436d0720e 100644 --- a/src/Sentry.Maui/Internal/SentryMauiOptionsSetup.cs +++ b/src/Sentry.Maui/Internal/SentryMauiOptionsSetup.cs @@ -15,7 +15,7 @@ internal class SentryMauiOptionsSetup : IConfigureOptions public SentryMauiOptionsSetup(IConfiguration config) { ArgumentNullException.ThrowIfNull(config); - _config = config; + _config = config.GetSection("Sentry"); } public void Configure(SentryMauiOptions options) diff --git a/src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs b/src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs index da2a569926..1cbefb19bf 100644 --- a/src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs +++ b/src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs @@ -44,9 +44,6 @@ public static MauiAppBuilder UseSentry(this MauiAppBuilder builder, { var services = builder.Services; - var section = builder.Configuration.GetSection("Sentry"); - services.AddSingleton>(_ => new SentryMauiOptionsSetup(section)); - if (configureOptions != null) { services.Configure(configureOptions); diff --git a/test/Sentry.Maui.Tests/SentryMauiAppBuilderExtensionsTests.cs b/test/Sentry.Maui.Tests/SentryMauiAppBuilderExtensionsTests.cs index 2bbd4b493e..c3fac5e100 100644 --- a/test/Sentry.Maui.Tests/SentryMauiAppBuilderExtensionsTests.cs +++ b/test/Sentry.Maui.Tests/SentryMauiAppBuilderExtensionsTests.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Options; using Sentry.Internal.Http; +using Sentry.Maui.Internal; using MauiConstants = Sentry.Maui.Internal.Constants; namespace Sentry.Maui.Tests; @@ -29,6 +30,24 @@ public Fixture() private readonly Fixture _fixture = new(); + [Fact] + public void UseSentry_RegistersEventProcessorOnlyOnce() + { + // Arrange + var builder = _fixture.Builder; + builder.Services.Configure(options => + { + options.Dsn = ValidDsn; + }); + + // Act + using var app = builder.UseSentry().Build(); + + // Assert + var options = app.Services.GetRequiredService>().Value; + options.EventProcessors.Should().ContainSingle(t => t.Type == typeof(SentryMauiEventProcessor)); + } + [Fact] public void CanUseSentry_WithConfigurationOnly() {