Skip to content

Commit 0ceacd0

Browse files
committed
Merge branch 'main' into 4082-hangfire_remove_strong_naming
2 parents 9eb67cc + bb765ee commit 0ceacd0

File tree

8 files changed

+40
-14
lines changed

8 files changed

+40
-14
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ jobs:
112112
run: dotnet restore Sentry-CI-Build-${{ runner.os }}.slnf --nologo
113113

114114
- name: Build
115+
id: build
115116
run: dotnet build Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
116117

117118
- name: Upload build logs
119+
if: ${{ steps.build.outcome != 'skipped' }}
118120
uses: actions/upload-artifact@v4
119121
with:
120122
name: ${{ runner.os }}-build-logs
@@ -124,13 +126,13 @@ jobs:
124126
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"
125127

126128
- name: Upload code coverage
127-
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574
129+
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d
128130

129131
- name: Upload build and test outputs
130132
if: failure()
131133
uses: actions/upload-artifact@v4
132134
with:
133-
name: verify-test-results
135+
name: ${{ runner.os }}-verify-test-results
134136
path: "**/*.received.*"
135137

136138
# To save time and disk space, we only create and archive the Nuget packages when we're actually releasing.

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Changelog
22

3-
## Unreleased
3+
## 5.6.0
44

55
### Features
66

7+
- Option to disable the SentryNative integration ([#4107](https://github.com/getsentry/sentry-dotnet/pull/4107), [#4134](https://github.com/getsentry/sentry-dotnet/pull/4134))
8+
- To disable it, add this msbuild property: `<SentryNative>false</SentryNative>`
79
- Reintroduced experimental support for Session Replay on Android ([#4097](https://github.com/getsentry/sentry-dotnet/pull/4097))
810

911
### Fixes
1012
- Remove Strong Naming from Sentry.Hangfire ([#4099](https://github.com/getsentry/sentry-dotnet/pull/4099))
13+
1114
- Ensure user exception data is not removed by AspNetCoreExceptionProcessor ([#4016](https://github.com/getsentry/sentry-dotnet/pull/4106))
1215
- Prevent users from disabling AndroidEnableAssemblyCompression which leads to untrappable crash ([#4089](https://github.com/getsentry/sentry-dotnet/pull/4089))
1316
- Fixed MSVCRT build warning on Windows ([#4111](https://github.com/getsentry/sentry-dotnet/pull/4111))
@@ -21,6 +24,9 @@
2124
- Bump Cocoa SDK from v8.39.0 to v8.46.0 ([#4103](https://github.com/getsentry/sentry-dotnet/pull/4103))
2225
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8460)
2326
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.39.0...8.46.0)
27+
- Bump Native SDK from v0.8.3 to v0.8.4 ([#4122](https://github.com/getsentry/sentry-dotnet/pull/4122))
28+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#084)
29+
- [diff](https://github.com/getsentry/sentry-native/compare/0.8.3...0.8.4)
2430

2531
## 5.5.1
2632

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>5.5.1</VersionPrefix>
4+
<VersionPrefix>5.6.0</VersionPrefix>
55
<LangVersion>13</LangVersion>
66
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

src/Sentry/Platforms/Native/SentryNative.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,23 @@ namespace Sentry;
77
internal static class SentryNative
88
{
99
#if NET8_0_OR_GREATER
10-
internal static bool IsAvailable { get; }
10+
// Should be in-sync with Sentry.Native.targets const.
11+
private const string SentryNativeIsEnabledSwitchName = "Sentry.Native.IsEnabled";
12+
13+
private static readonly bool IsAvailableCore;
14+
15+
#if NET9_0_OR_GREATER
16+
// FeatureSwitchDefinition should help with trimming disabled code.
17+
// This way, `SentryNative.IsEnabled` should be treated as a compile-time constant for trimmed apps.
18+
[FeatureSwitchDefinition(SentryNativeIsEnabledSwitchName)]
19+
#endif
20+
private static bool IsEnabled => !AppContext.TryGetSwitch(SentryNativeIsEnabledSwitchName, out var isEnabled) || isEnabled;
21+
22+
internal static bool IsAvailable => IsEnabled && IsAvailableCore;
1123

1224
static SentryNative()
1325
{
14-
IsAvailable = AotHelper.IsTrimmed && !SentryRuntime.Current.IsBrowserWasm();
26+
IsAvailableCore = AotHelper.IsTrimmed && !SentryRuntime.Current.IsBrowserWasm();
1527
}
1628
#else
1729
// This is a compile-time const so that the irrelevant code is removed during compilation.

src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,21 @@
88
Note:Target framework conditions should be kept synchronized with src/Sentry/buildTransitive/Sentry.Native.targets -->
99
<Project>
1010

11+
<ItemGroup>
12+
<!-- When user sets <SentryNative>false</SentryNative> or <SentryNative>disable</SentryNative> in their project -->
13+
<!-- SentryNative.IsEnabled should result in compile-time constant for trimmed applications -->
14+
<!-- Effectively disabling native library -->
15+
<RuntimeHostConfigurationOption Include="Sentry.Native.IsEnabled"
16+
Condition="'$(SentryNative)' != 'false' and '$(SentryNative)' != 'disable'"
17+
Value="true"
18+
Trim="true" />
19+
</ItemGroup>
20+
1121
<PropertyGroup>
1222
<!-- net8.0 or greater -->
1323
<FrameworkSupportsNative Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</FrameworkSupportsNative>
24+
<!-- Make it opt-out -->
25+
<FrameworkSupportsNative Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'">false</FrameworkSupportsNative>
1426
</PropertyGroup>
1527

1628
<ItemGroup Condition="'$(FrameworkSupportsNative)' == 'true' and '$(RuntimeIdentifier)' == 'win-x64'">

src/Sentry/Sentry.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<ItemGroup Condition="'$(SolutionName)' == 'Sentry.Unity'">
2424
<InternalsVisibleTo Include="Sentry.Unity" />
25+
<InternalsVisibleTo Include="Sentry.Unity.Tests" />
2526
</ItemGroup>
2627

2728
<!-- Platform-specific props included here -->

src/Sentry/SentrySdk.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,6 @@ internal static IDisposable UseHub(IHub hub)
209209
return new DisposeHandle(hub);
210210
}
211211

212-
/// <summary>
213-
/// Allows to set the trace
214-
/// </summary>
215-
internal static void SetTrace(SentryId traceId, SpanId parentSpanId) =>
216-
CurrentHub.ConfigureScope(scope =>
217-
scope.SetPropagationContext(new SentryPropagationContext(traceId, parentSpanId)));
218-
219212
/// <summary>
220213
/// Flushes the queue of captured events until the timeout set in <see cref="SentryOptions.FlushTimeout"/>
221214
/// is reached.

0 commit comments

Comments
 (0)