Skip to content

fix: rename DisableSentryNative to SentryNative #4134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Features

- Option to disable the SentryNative integration ([#4107](https://github.com/getsentry/sentry-dotnet/pull/4107))
- Option to disable the SentryNative integration ([#4107](https://github.com/getsentry/sentry-dotnet/pull/4107), [#4134](https://github.com/getsentry/sentry-dotnet/pull/4134))
- Reintroduced experimental support for Session Replay on Android ([#4097](https://github.com/getsentry/sentry-dotnet/pull/4097))

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Platforms/Native/SentryNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class SentryNative

#if NET9_0_OR_GREATER
// FeatureSwitchDefinition should help with trimming disabled code.
// This way, `SentryNative.IsEnabled` should be treated as a compile-time constant for trimmed apps.
// This way, `Sentry.Native.IsEnabled` should be treated as a compile-time constant for trimmed apps.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This way, `Sentry.Native.IsEnabled` should be treated as a compile-time constant for trimmed apps.
// This way, `SentryNative.IsEnabled` should be treated as a compile-time constant for trimmed apps.

It's internal static class SentryNative

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ... it's referring to the property name, not the switch name ... my bad ... reverted

[FeatureSwitchDefinition(SentryNativeIsEnabledSwitchName)]
#endif
private static bool IsEnabled => !AppContext.TryGetSwitch(SentryNativeIsEnabledSwitchName, out var isEnabled) || isEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<Project>

<ItemGroup>
<!-- When user sets <DisableSentryNative>true</DisableSentryNative> in their project -->
<!-- SentryNative.IsEnabled should result in compile-time constant for trimmed applications -->
<!-- When user sets <SentryNative>false</SentryNative> or <SentryNative>disable</SentryNative> in their project -->
<!-- Sentry.Native.IsEnabled should result in compile-time constant for trimmed applications -->
<!-- Effectively disabling native library -->
<RuntimeHostConfigurationOption Include="Sentry.Native.IsEnabled"
Condition="'$(DisableSentryNative)' != 'true'"
Condition="'$(SentryNative)' != 'false' and '$(SentryNative)' != 'disable'"
Value="true"
Trim="true" />
</ItemGroup>
Expand All @@ -22,7 +22,7 @@
<!-- net8.0 or greater -->
<FrameworkSupportsNative Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</FrameworkSupportsNative>
<!-- Make it opt-out -->
<FrameworkSupportsNative Condition="'$(DisableSentryNative)' == 'true'">false</FrameworkSupportsNative>
<FrameworkSupportsNative Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'">false</FrameworkSupportsNative>
</PropertyGroup>

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