4

In my Xamarin iOS app I enabled AppCenter's Analytics and Crash how explained here: https://learn.microsoft.com/en-us/appcenter/sdk/getting-started/xamarin

Analytics works, but I'm not able to see any crash/error on the Diagnostic section of App Center web console. In troubleshooting page there is written that on iOS cannot be more than a tool for exception handling, and this is the only one. In my app I enabled FCM so there is Firebase, I tried to remove any reference to Firebase but nothing changes.

Enabling AppCenter.LogLevel = LogLevel.Verbose; I can see that when app crashes AppCenter tries to store the exception ("Storing a log to Crashes"), but after I can see a "Found an empty buffer position". At the restart I see that SendingErrorReport callback is called, but SentErrorReport and FailedToSendErrorReport are ignored.

After AppCenter.Start I tried to call await Crashes.SetEnabledAsync(true). If I let it crash and when I reopen the app I call ErrorReport crashReport = await Crashes.GetLastSessionCrashReportAsync() crash report is always null.

In Symbols section I can read "You're awesome! There are no unsymbolicated crashes". I tried to compile in Debug and in Release. I tried to launch a new Exception and to use Crashes.GenerateTestCrash.

I didn't have any problem using Analytics and Crash with a Xamarin.Forms app.

Mauro Piccotti
  • 1,807
  • 2
  • 23
  • 34
  • For iOS - "You need to restart the app after a crash and App Center Crashes will forward the crash log only after it is restarted. In addition, on Xamarin.iOS, the SDK will not save any crash log if you attached a debugger. Make sure the debugger is not attached when you crash the iOS app". If you still don't see the crash reports, please click on the blue icon in the lower right of App Center portal and open a support ticket so that we can better assist you. Please share the verbose logs of your app before and after the app crash. Thanks! – Ela Mar 26 '18 at 17:32
  • Hi, if the sending event is triggered but not sent or failed to send then it's probably struggling with network calls. Verbose logs contain all details about the HTTP calls that are made (url, headers, json and status code and retries). If you need help with understanding logs you can share them on support using blue chat button on any page of the appcenter portal. – Guillaume Perrot Mar 26 '18 at 18:01
  • I did my test both on device and simulator, compiling in release, letting the app crash and then restarting. Hoping that it won't be a bug but simply a misuse of the tool I wrote my question and then I sent the link to support team, which immediately answered. In both cases if we solve the solution can be useful to the community. – Mauro Piccotti Mar 26 '18 at 20:20
  • Hi @MauroPiccotti. I think you need to be in debug mode: https://learn.microsoft.com/en-us/appcenter/sdk/crashes/xamarin "This API checks for debug vs release configurations. So you can use only use it when debugging as it won't work for release apps." – Chucky Jun 06 '18 at 12:45
  • @Chucky thank you but I gave up with AppCenter for crashes, but I'm quite sure that I tried both in debug and release. Thank you anyway. – Mauro Piccotti Jun 06 '18 at 14:58

2 Answers2

3

This kind configuration works me as well:

using Microsoft.AppCenter.Crashes;

AppCenter.Start(Settings.AppCenterConfigString, typeof(Analytics), typeof(Crashes) /*, typeof(Push)*/);
Crashes.NotifyUserConfirmation(UserConfirmation.AlwaysSend);

Custom Exception (Error) logging:

catch (Exception e) { Crashes.TrackError(e, ...); }

https://learn.microsoft.com/en-us/appcenter/sdk/crashes/xamarin#ask-for-the-users-consent-to-send-a-crash-log

  • I know its an old thread but I had similar issue and reason was the App type was not correctly set in AppCenter. I was working on WPF app where as in AppCenter it was configured as UWP app. – Riz Oct 11 '19 at 06:10
2

Finally after lot of hit and trial I have found that you have to override a different FinishedLaunching method, which provides UIApplication & NSDictionary params.

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            AppCenter.LogLevel = LogLevel.Verbose; //just so you can see in debug //that it is running successfully
            AppCenter.Start(#your app id#, typeof(Crashes));
}

You are welcome ;-)


  1. Error logs will be uploaded the next time app loads, so crash it on a button click, then close the app and remove it from recent apps.
  2. Start the app again and wait couple of moments, then see the web UI
  3. Depending upon the OS version you also have to add following code into the info.plist

    <key>NSAppTransportSecurity</key>
      <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
      </dict>
AZ_
  • 21,688
  • 25
  • 143
  • 191
  • 1
    +1 Jsut an FYI for some people. I followed their getting started guide and I did not get anything on the Analytics tab. That is until I had set the LogLevel to `LogLevel.Verbose`. So just an FYI, make sure you do this to get it working. – philm Apr 13 '20 at 14:17