question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application crashing only in release mode, how to debug this kind of problem?

See original GitHub issue

Environment

Environment: OS: macOS High Sierra 10.13 Node: 9.10.1 Yarn: Not Found npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed) react: ^16.3.0 => 16.3.0 react-native: ^0.55.0 => 0.55.0

Steps to Reproduce

Follow the steps in https://facebook.github.io/react-native/docs/running-on-device.html, Building your app for production. Run a release build. Open Xcode. Go to edit schemes. Change the Run build configuration from Debug to Release. Or you can run it from terminal: react-native run-ios --configuration Release

Expected Behavior

JS bundle completes launch and app doesn’t crash.

Actual Behavior

App crashes when the JS bundle loads. Here is the crash log:

*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Cannot call a class as a function', reason: 'Unhandled JS Exception: Cannot call a class as a function, stack: classCallCheck@11:648 t@306:876 run@279:617 runApplication@279:2046 value@18:3471 <unknown>@18:956 value@18:2898 value@18:928

My application works fine on release for Android, and also works fine in debug mode on iOS, the problem only appears on iOS release mode. How should i debug problems in release mode? I Tried to reident and look at the lines of code suggested on the error message in the main.jsbundle, but i haven’t been able to find the source of the problem anyway.

I tried everything i found on the issues #18647 #16567 and in similar issues. My application code is huge so i cant check every react class to find the problem(although i tried). Should i try to reinstall all my dependencies from zero until i find what is causing the problem? It seems like react native have absolutely no support for this kind of release bugs problem from the other issues i have seen.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:18
  • Comments:10

github_iconTop GitHub Comments

37reactions
react-native-botcommented, Apr 3, 2018

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

17reactions
vzaffaloncommented, Apr 4, 2018

after 5 days looking for the issue i found out the problem was that my index.ios.js was calling my main class like this AppRegistry.registerComponent('App', App); when it actually should have been like this AppRegistry.registerComponent('App', () => App);

For anyone that got stuck in release bugs like me try installing the haul library https://github.com/callstack/haul, it still has many bugs, but it gives much better error messages then the react native core. Debugging this problem would be impossible if i had not found haul.

I also had to use haul to bundle the javascript without minification to be able to find about the bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Program only crashes as release build -- how to debug?
Crashes like this are almost always caused because an IDE will usually set the contents of uninitialized variable to zeros, null ...
Read more >
Application Crashing only in release mode - MSDN - Microsoft
When we run the application in debug mode everything is fine. Once we switch to release mode, the application crashes in a random...
Read more >
C++ application crashes in release mode - CodeProject
The number 1 reason a program crashes in release mode but not debug mode is due to using an initialized variable.
Read more >
Crash when run in Release mode? - Qt Forum
Try running your Release executable under debugger. When it crashes inside debugger you still get trace back. If you are lucky, and it...
Read more >
Loop that works in debug but not release. - Apple Developer
This code works fine in debug mode, but invariably crashes in release mode. The values have all been used previously in the loop,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found