2

I have a Xamarin.Forms Android app that runs reliably in debug build but crashes immediately, on startup, in release build.

My dev environment comprises of a Windows 10 PC with Visual Studio 2019, which is USB connected to the Android 9.0 device that I am testing against.

I have attempted to narrow down the cause of the issue by editing the Visual Studio release build configuration, one setting at a time, until it matches the working debug configuration. However, even with the release build config identical to the debug build config, the crash still occurs. Does this mean that Visual Studio is applying some other release build settings, apart from those configurable in the UI?

Is there any way to access diagnostic information from this crash? Any other suggestions how to identify the cause?

I am happy to post more details of the project configuration and development environment, if it helps.

Update: As suggested by several posters, I have retrieved the logcat data for the crash, but I am not sure how to interpret it, or where to go next:

enter image description here

Tim Coulter
  • 8,705
  • 11
  • 64
  • 95
  • 1
    You should use Logcat and check what the error is when the application starts. – Bruno Caceiro Aug 22 '19 at 10:20
  • appcenter.ms will allow you to log crash information – Jason Aug 22 '19 at 10:22
  • Have you tried changing linker options? Try with `None`. – Rajesh Sonar Aug 22 '19 at 11:58
  • @RajeshSonar - yes, I was also hoping that the linker options might be the culprit, but it didn't make any difference. Thanks – Tim Coulter Aug 22 '19 at 13:13
  • @BrunoCaceiro - I have updated my question to include the captured log output, but I don't know how to interpret it. – Tim Coulter Aug 22 '19 at 13:15
  • @Jason - I would love to believe you, but I have tried multiple web platforms that claim to capture crash data and none of them has actually worked. Routine logging works fine but, in my experience, crash logs are always lost in the ether. – Tim Coulter Aug 22 '19 at 13:16
  • It seems to be related with android banning implicit intents in Android O and above. More info [here](https://commonsware.com/blog/2017/04/11/android-o-implicit-broadcast-ban.html). Related question and possible solution [here](https://stackoverflow.com/questions/46431606/background-execution-not-allowed-android-o-pendingintent). – Rajesh Sonar Aug 22 '19 at 13:55
  • Do you find any solution for this ? i'm facing same issue – ASalameh Nov 06 '19 at 12:04
  • @DevC This is probably not the answer that you want to hear, but I uninstalled and reinstalled Visual Studio and the problem went away. – Tim Coulter Nov 07 '19 at 13:19

1 Answers1

3

Check the Device Log. It should contain Unhandled Exception Info for your App. See here: View->Other Windows->Device Log - it is the Logcat's log, just in built-in to VisualStudio window. Tip1: Open it before running your App, and choose your device in top-left. Tip2: Watch the log immediately after the crash (better copy-it, paste into an editor), because it is overwhelmed by messages very quickly.

  • Many thanks Alexandr - that's very helpful (and much easier than using ADB). I have updated my question to include a screenshot of the crash data, but I am still not clear what it tells me. Any further advice please? – Tim Coulter Aug 22 '19 at 13:03
  • The exact reason should be right below the "SIGSEGV" error string. Watching at "Cause: null pointer dereference", it looks like you are trying to access a member on an object, that is null. – Olexandr Chervinsky Aug 22 '19 at 14:46
  • Thanks again Alexandr. It puzzles me why this happens in release build and not in debug, but I guess I am a little closer to finding the problem. – Tim Coulter Aug 22 '19 at 15:25