Skip to content

Prevent users building with AndroidEnableAssemblyCompression set to false #4089

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 5 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Changed default value for `SentryOptions.EnableAppHangTrackingV2` to `false` ([#4042](https://github.com/getsentry/sentry-dotnet/pull/4042))
- Missing MAUI `Shell` navigation breadcrumbs on iOS ([#4006](https://github.com/getsentry/sentry-dotnet/pull/4006))
- Prevent application crashes when capturing screenshots on iOS ([#4069](https://github.com/getsentry/sentry-dotnet/pull/4069))
- Prevent users from disabling AndroidEnableAssemblyCompression which leads to untrappable crash ([#4089](https://github.com/getsentry/sentry-dotnet/pull/4089))

### Dependencies

Expand Down
6 changes: 6 additions & 0 deletions src/Sentry/buildTransitive/Sentry.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<SentryAttributesFile>Sentry.Attributes$(MSBuildProjectExtension.Replace('proj', ''))</SentryAttributesFile>
</PropertyGroup>

<Target Name="_SentryEnsureAndroidEnableAssemblyCompressionDisabled"
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND '$(AndroidEnableAssemblyCompression)' == 'false'"
BeforeTargets="ResolveAssemblyReferences;Build;Rebuild">
<Error Text="Android projects using Sentry cannot build using AndroidEnableAssemblyCompression = false due to a Microsoft issue. Please follow https://github.com/dotnet/android/issues/9752" />
</Target>

<Target Name="WriteSentryAttributes"
Condition="$(Language) == 'VB' or $(Language) == 'C#' or $(Language) == 'F#'"
BeforeTargets="BeforeCompile;CoreCompile"
Expand Down
Loading