sentry-dotnet: MAUI MacCatalyst Apps have a `default.profraw` generated inside the .app bundle when the app exits

Package

Sentry

.NET Flavor

.NET

.NET Version

8.0.0

OS

macOS

SDK Version

4.0.0-beta.4

Self-Hosted Sentry Version

No response

Steps to Reproduce

  1. dotnet new maui
  2. Add Sentry, configure it for a MAUI project
  3. Build/Debug the MacCatalyst target
  4. Quit the app (IMPORTANT: Quit it gracefully, do not terminate it)
  5. Observe in the bin/Debug/net8.0-maccatalyst/MauiApp1.app bundle there should be a default.profraw file now
  6. Make a change to some c# and/or xaml in the app
  7. Build/Debug MacCatalyst target again
  8. Observe a build error which complains about codesigning and unsigned contents in bundle, ultimately pointing at the default.profraw file.

Expected Result

This file should not get created at least in this location.

Actual Result

File gets created, causing subsequent incremental builds to fail.

Video: https://github.com/getsentry/sentry-dotnet/assets/271950/bae02c29-aaa3-42e2-86b0-8322ec208d0f

Sample/Repro project: Archive.zip

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 17 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks a lot @akoeplinger !! Great to have you contribute here, come again 😃

So this is definitely coming from sentry-cocoa since nm shows this symbol:

00000000001898c4 s ___llvm_profile_runtime

This static initializer is used to hook up profiling (INSTR_PROF_PROFILE_RUNTIME_VAR is ___llvm_profile_runtime): https://github.com/llvm/llvm-project/blob/2b1c76c7c4d62f4470fe1527bf239f380c19760a/compiler-rt/lib/profile/InstrProfilingRuntime.cpp#L23

Seems this is enabled via the -fprofile-instr-generate flag when compiling LLVM https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#compiling-with-coverage-enabled

It looks like sentry-native builds with that if RUN_ANALYZER env var is set: https://github.com/getsentry/sentry-native/blob/0b17731c74e40202dea2e10b6c4aec8d6e66a1cd/tests/cmake.py#L152-L155

Did you perhaps pick the binary from the build that enables this instead of the normal one? https://github.com/getsentry/sentry-native/blob/0b17731c74e40202dea2e10b6c4aec8d6e66a1cd/.github/workflows/ci.yml#L74-L80