Skip to content

Commit

Permalink
Merge branch 'main' into disable-ndk
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrosswell authored Jan 28, 2025
2 parents 179d173 + 81452c1 commit 60ea6ee
Show file tree
Hide file tree
Showing 34 changed files with 95 additions and 87 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,28 @@

### Significant change in behavior
- The NDK is now disabled by default on Android, to prevent SIGSEGV errors resulting from managed NullReferenceExceptions ([#3903](https://github.com/getsentry/sentry-dotnet/pull/3903))
- 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))
- 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.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)
- 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

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

<!-- Set the version and local path for Sentry CLI (downloaded in the restore phase of Sentry.csproj) -->
<PropertyGroup Condition="'$(SolutionName)' != 'Sentry.Unity'">
<SentryCLIVersion>2.40.0</SentryCLIVersion>
<SentryCLIVersion>2.41.1</SentryCLIVersion>
<SentryCLIDirectory>$(MSBuildThisFileDirectory)tools\sentry-cli\$(SentryCLIVersion)\</SentryCLIDirectory>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2024 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
Expand Down
2 changes: 1 addition & 1 deletion Sentry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFrameworks>net8.0-android34.0</TargetFrameworks>
<!-- BG8605 and BG8606 happen because there's a missing androidx.lifecycle dependency, but we don't need it here. (The native Android Sentry SDK will use it if it exists.) -->
<NoWarn>$(NoWarn);BG8605;BG8606</NoWarn>
<SentryAndroidSdkVersion>7.20.0</SentryAndroidSdkVersion>
<SentryAndroidSdkVersion>7.20.1</SentryAndroidSdkVersion>
<SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory>
<Description>.NET Bindings for the Sentry Android SDK</Description>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Maui/Internal/SentryMauiOptionsSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class SentryMauiOptionsSetup : IConfigureOptions<SentryMauiOptions>
public SentryMauiOptionsSetup(IConfiguration config)
{
ArgumentNullException.ThrowIfNull(config);
_config = config;
_config = config.GetSection("Sentry");
}

public void Configure(SentryMauiOptions options)
Expand Down
3 changes: 0 additions & 3 deletions src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public static MauiAppBuilder UseSentry(this MauiAppBuilder builder,
{
var services = builder.Services;

var section = builder.Configuration.GetSection("Sentry");
services.AddSingleton<IConfigureOptions<SentryMauiOptions>>(_ => new SentryMauiOptionsSetup(section));

if (configureOptions != null)
{
services.Configure(configureOptions);
Expand Down
10 changes: 7 additions & 3 deletions src/Sentry/Internal/Enricher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@
<_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</_OSArchitecture>
</PropertyGroup>
<ItemGroup>
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('OSX')) And $(_OSArchitecture) == 'Arm64')" Include="sentry-cli-Darwin-arm64" FileHash="a337af0456c497300fa2e5612ad42b917b1f98428e1dec433caef12fa881538a" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('OSX')) And $(_OSArchitecture) == 'X64')" Include="sentry-cli-Darwin-x86_64" FileHash="45afbc9e8ba2a58112207df5cbc7ba348a858205f429adb5b55fc5f1e01034b0" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'Arm64')" Include="sentry-cli-Linux-aarch64" FileHash="9bf86f9a4df6d2016b8564f3b6f0eaa1df351fcd6810f25a0f7cb4b408dc16cb" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'X86')" Include="sentry-cli-Linux-i686" FileHash="cb91f2a0145da32be30b072867db78765e3ff37155cf8b2f249960e067aa91ec" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'X64')" Include="sentry-cli-Linux-x86_64" FileHash="342d5440a7e852fc4d7621c3fa5efe302056bf0ada3f9a96fca1006b3eb297ab" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Windows')) And $(_OSArchitecture) == 'X86')" Include="sentry-cli-Windows-i686.exe" FileHash="8f871a9994aaacab39cda14b9cd2f1a8554d8d7318e137d33593813931ace966" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Windows')) And $(_OSArchitecture) != 'X86')" Include="sentry-cli-Windows-x86_64.exe" FileHash="b8f8630bd29d596086349dda034ef0957275c60ce8566549d1e19ad5dfa3990f" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('OSX')) And $(_OSArchitecture) == 'Arm64')" Include="sentry-cli-Darwin-arm64" FileHash="1ea7af1fb121d1274f512c8419ede11c9ebd2f249089a0b006041a3d5466febb" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('OSX')) And $(_OSArchitecture) == 'X64')" Include="sentry-cli-Darwin-x86_64" FileHash="b02484e776275d7ab94702f26976d8eb36d3450548edbc1b12acca1f2ce4123f" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'Arm64')" Include="sentry-cli-Linux-aarch64" FileHash="a2361706bd8fd624edd73945f70e7ff761163258476292872dadea1bfe2f241e" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'X86')" Include="sentry-cli-Linux-i686" FileHash="11988b764a08ff3711582854cae7e0b31cfbb3164bb1c9798d4fb1e89c0a9a02" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'X64')" Include="sentry-cli-Linux-x86_64" FileHash="a007369907840f26b68d0ce83037abf2b14fc68162fdef1d071885a1ace5e3cf" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Windows')) And $(_OSArchitecture) == 'X86')" Include="sentry-cli-Windows-i686.exe" FileHash="8a25bfb2c550a067966dc330ce386da56a9343cf8cefebc096b7ee4c915e759f" />
<SentryCLIDownload Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Windows')) And $(_OSArchitecture) != 'X86')" Include="sentry-cli-Windows-x86_64.exe" FileHash="34878a7f30c3da8861455a2e8a8cfbd5a861649e11fe88432e9b610c83650896" />
</ItemGroup>

<!-- Download the files -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Environment: production,
Breadcrumbs: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Environment: production,
Breadcrumbs: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Spans: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Spans: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
}
}
},
Expand All @@ -46,8 +45,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Breadcrumbs: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
}
}
},
Expand All @@ -46,8 +45,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Breadcrumbs: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
}
}
},
Expand All @@ -46,8 +45,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Breadcrumbs: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
}
}
},
Expand All @@ -46,8 +45,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Breadcrumbs: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Environment: production
}
Expand All @@ -47,8 +46,7 @@
}
},
User: {
Id: Guid_1,
IpAddress: {{auto}}
Id: Guid_1
},
Environment: production,
Breadcrumbs: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
}
},
User: {
Id: Guid_3,
IpAddress: {{auto}}
Id: Guid_3
},
Environment: production
}
Expand Down Expand Up @@ -75,8 +74,7 @@
}
},
User: {
Id: Guid_3,
IpAddress: {{auto}}
Id: Guid_3
},
Environment: production
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
}
},
User: {
Id: Guid_3,
IpAddress: {{auto}}
Id: Guid_3
},
Environment: production
}
Expand Down
19 changes: 19 additions & 0 deletions test/Sentry.Maui.Tests/SentryMauiAppBuilderExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -29,6 +30,24 @@ public Fixture()

private readonly Fixture _fixture = new();

[Fact]
public void UseSentry_RegistersEventProcessorOnlyOnce()
{
// Arrange
var builder = _fixture.Builder;
builder.Services.Configure<SentryMauiOptions>(options =>
{
options.Dsn = ValidDsn;
});

// Act
using var app = builder.UseSentry().Build();

// Assert
var options = app.Services.GetRequiredService<IOptions<SentryMauiOptions>>().Value;
options.EventProcessors.Should().ContainSingle(t => t.Type == typeof(SentryMauiEventProcessor));
}

[Fact]
public void CanUseSentry_WithConfigurationOnly()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
}
},
User: {
Id: Guid_3,
IpAddress: {{auto}}
Id: Guid_3
},
Environment: production
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
}
},
User: {
Id: Guid_3,
IpAddress: {{auto}}
Id: Guid_3
},
Environment: production
}
Expand Down
Loading

0 comments on commit 60ea6ee

Please sign in to comment.