newrelic / newrelic-ios-agent-spm

This repository hosts the Swift Package Manager deployment of the iOS agent
Apache License 2.0
15 stars 9 forks source link

Adding NewRelic 7.4.4 dependency breaks code coverage in Xcode 14.3 project #30

Closed paulz closed 1 year ago

paulz commented 1 year ago

Description

Xcode 14.3 fails to report test coverage after adding NewRelic

Steps to Reproduce

  1. clone https://github.com/paulz/DemoNewRelicCoverageIssue
  2. Run Test in Xcode 14.3
  3. see Xcode test result: https://github.com/paulz/DemoNewRelicCoverageIssue/files/11380348/tests-10.xcresult.zip

Expected Behavior

Test Coverage is shown in Xcode and saved in xcresult bundle

Relevant Logs / Console output

invalid instrumentation profile data (file header is corrupt)

Showing All Messages Failed to merge raw profiles in directory ~/Library/Developer/Xcode/DerivedData/Onegin-dgyrgjyxmviubcfqqnzgirpgdysc/Build/ProfileData/6DDF1A2E-D1E4-4DFD-8102-84CEF5A7C5E3 to destination ~/Library/Developer/Xcode/DerivedData/Onegin-dgyrgjyxmviubcfqqnzgirpgdysc/Build/ProfileData/6DDF1A2E-D1E4-4DFD-8102-84CEF5A7C5E3/Coverage.profdata: Aggregation tool '/Applications/Xcode_14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata' failed with exit code 1: warning: ~/Library/Developer/Xcode/DerivedData/Onegin-dgyrgjyxmviubcfqqnzgirpgdysc/Build/ProfileData/6DDF1A2E-D1E4-4DFD-8102-84CEF5A7C5E3/A175CEE6-A7FC-48BD-A919-DB64D7B3C459-16393.profraw: invalid instrumentation profile data (file header is corrupt) error: no profile can be merged

screenshot

Your Environment

Additional context

paulz commented 1 year ago

probable solution is to disable code coverage for NewRelic framework for Release:

image
krissbennett commented 1 year ago

I'm having same problem when using a TestPlan on a Local package that imports 7.4.4 anyone found a fix for this yet?

cdillard-NewRelic commented 1 year ago

Please try with our new 7.4.6 release. Let us know if that resolves the issue or not. Thank you!

paulz commented 1 year ago

Thank you we resolved the issue, but I am not able to confirm as I off that project. Workaround that helped is to load NewRelic only when not running tests.

cdillard-NewRelic commented 1 year ago

A fix for this issue has been included with New Relic iOS agent 7.4.6

NicolasEymael commented 8 months ago

Thank you we resolved the issue, but I am not able to confirm as I off that project. Workaround that helped is to load NewRelic only when not running tests.

hi @paulz, i am having the same problem

how do i do this workaround? i couldnt find how to load NewRelic only when not running tests...