33

I can not print debug information in my UI TESTS. Configuration: Xcode 10 and SWIFT 4.2.

When I try to print something in console I can only see an error:

"error: Couldn't IRGen expression, no additional error" 

I didn't have any problem in earlier versions of Xcode (8,9 etc), only in Xcode 10. I can not print anything, when I put breakpoint and try to print for example app po XCUIApplication() or something like that.

In the earlier version of Xcode when I write in console:

"po XCUIApplication.debugDescription()"I saw the structure of my application.

We found that the problem appears when an external framework is added to the UI Tests Target. We've created an example project with RxSwift.framework included which can be use to reproduce our issue:

https://drive.google.com/file/d/1BlByFVNaOdDqT4ED9Jwyi1kJ99PTRQen/view?usp=sharing

Regards.

Paweł Zemsta
  • 339
  • 1
  • 3
  • 5

3 Answers3

28

I had same issue with Carthage. However while looking more closely at console I've spotted that Carthage instead of building RxSwift just downloaded pre-built binaries,

*** Downloading RxSwift.framework binary at "Zürich"

that in turn contribute to IRGen error. So forcing Carthage to build framework instead of downloading binary worked.

carthage update --platform iOS --no-use-binaries
MichaelV
  • 1,231
  • 8
  • 10
  • 2
    The `carthage update --platform iOS --no-use-binaries` works fine for me. But if you´re working with other developers and you´re pushing the carthage builds to the repo, the problem still happens to the other developers, because the RxSwift build was made on my computer. And this only happens with the RxSwift frameworks. – Pedro Silva Oct 01 '19 at 16:07
4

The swift debugging format is a binary dump of Swift internal objects so you have to have compiled your binaries with the compiler that ships with the debugger you are using or things go badly.

I can repro the behavior you were seeing using Xcode 10.0 and the project you provided. But then I got the RxSwift sources from github and rebuilt them with the Xcode 10.0 compiler and replaced your RxSwift.framework with the one I built locally and reran the test, and the expression you had attached to the breakpoint worked correctly. Can you see if that also works for you?

The debugger should have given a better error message, if you want to file a bug with the swift bug reporter (http://bugs.swift.org) we can look at improving the error message.

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63
  • Didn't help me: app using internal framework, rebuilt everything locally. Still same error. Xcode 10, development target iOS 9.0, running app in iOS 11.2 simulator – JOM Sep 21 '18 at 07:13
  • @JOM If you can share your project please file a bug either with http://bugs.swift.org or http://bugreporter.apple.com. Rebuilding everything is currently a necessary condition for success, any case where it isn't also a sufficient condition, we'd like to have a look at. – Jim Ingham Sep 21 '18 at 18:25
  • 1
    Sorry, massive corporate app. Cannot share the project nor able to create small standalone sample :( – JOM Sep 27 '18 at 07:04
2

I had the same issue with Carthage - RxSwift.

Deleting files from

Carthage/Build/...

Carthage/Checkouts/

And calling carthage update in terminal resolved my issue.

Update:

We noticed this issue happens only when updating RxSwift library to version 4.3 and above. Setting version to 4.2.x works normal.

Arijan
  • 297
  • 3
  • 6