microsoft / appcenter-sdk-dotnet

Development repository for the App Center SDK for .NET platforms, including Xamarin
Other
311 stars 141 forks source link

Appcenter crashes are not collected and reported in net6.0/7.0-ios project #1703

Closed marekdovjak closed 1 year ago

marekdovjak commented 2 years ago

Description

I'm unable to use appcenter crashes in net6.0/7.0-ios project. No crashes are reported

Repro Steps

  1. Create new net6.0-ios or net7.0-ios application project in vs2022 for mac
  2. Start appcenter with following code AppCenter.Start(your-app-key, new[] { typeof(Analytics), typeof(Crashes) });
  3. Generate test crash/exception
  4. Crash is not reported (tested with no debugger attached)

Details

After calling AppCenter.Start(your-app-key, new[] { typeof(Analytics), typeof(Crashes) }); there are following errors in the output console

2022-11-24 09:35:36.315 test123[6250:3157391] [AppCenter] ERROR: +[MSACDBStorage executeSelectionQuery:inOpenedDatabase:result:withValues:]_block_invoke/409 Query failed with error: 5
    database is locked
2022-11-24 09:35:36.315 test123[6250:3157391] [AppCenter] ERROR: +[MSACDBStorage executeQuery:inOpenedDatabase:withValues:usingBlock:]/362 Failed to finalize SQLite statement, result=5
    database is locked
2022-11-24 09:35:36.316 test123[6250:3157425] [AppCenter] ERROR: +[MSACDBStorage executeNonSelectionQuery:inOpenedDatabase:withValues:]_block_invoke/338 Could not execute the statement, result=5
    database is locked
2022-11-24 09:35:36.316 test123[6250:3157425] [AppCenter] ERROR: +[MSACDBStorage executeQuery:inOpenedDatabase:withValues:usingBlock:]/362 Failed to finalize SQLite statement, result=5
    database is locked
AnatolyPristensky commented 2 years ago

Hello @marekdovjak, could you please share what version of AppCenter you are using? Also what platform you are using - Xamarin or MAUI?

marekdovjak commented 2 years ago

@AnatolyPristensky Sorry I forgot to mention, it's AppCenter version 5.0.0

AnatolyPristensky commented 2 years ago

@marekdovjak, could you please confirm that issue reproducing on an empty project? Also it would be great if you can share a sample project with reproduction of this issue.

marekdovjak commented 2 years ago

Yes, empty project. Here's source code test123.zip

AnatolyPristensky commented 2 years ago

@marekdovjak, unfortunately I'm not able to reproduce mentioned issue on a provided project. Here is my log:

2022-11-24 17:59:57.758827+0400 test123[3094:6575072] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.

2022-11-24 17:59:57.758975+0400 test123[3094:6575072] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.

2022-11-24 17:59:57.759335+0400 test123[3094:6575072] [AppCenter] DEBUG: -[MSACDBStorage initWithSchema:version:filename:]_block_invoke/38 SQLite global configuration successfully updated.

2022-11-24 17:59:57.767612+0400 test123[3094:6575072] [AppCenter] INFO: -[MSACAppCenter configureWithAppSecret:transmissionTargetToken:fromApplication:]/350 App Center SDK configured successfully.

2022-11-24 17:59:57.767948+0400 test123[3094:6575072] [AppCenter] VERBOSE: -[MSACAppCenter startServices:withAppSecret:transmissionTargetToken:fromApplication:]/376 Start services MSACCrashes, MSACAnalytics from an application

2022-11-24 17:59:57.837226+0400 test123[3094:6575072] [AppCenterCrashes] INFO: -[MSACCrashes applyEnabledState:]/454 Crashes service has been enabled.

2022-11-24 17:59:57.863622+0400 test123[3094:6575072] [AppCenterCrashes] VERBOSE: -[MSACCrashes startWithChannelGroup:appSecret:transmissionTargetToken:fromApplication:]/499 Started crash service.

2022-11-24 17:59:57.866089+0400 test123[3094:6576219] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAnalytics: 0x60000339c7e0> removed from pause lane for channel Analytics.

2022-11-24 17:59:57.872865+0400 test123[3094:6576219] [AppCenter] VERBOSE: -[MSACLogDBStorage saveLog:withGroupId:flags:]_block_invoke/130 Log is stored with id: '8'

Could you please provide Verbose logs?

marekdovjak commented 2 years ago

@AnatolyPristensky here's the log. I also tried to create new app in the appcenter and use the new app secret key, but there are still no crashes reported. The ERROR: +[MSACDBStorage doesn't always appear in the log.

Analytics data (active users, sessions...) are updating properly. The Crashes.ShouldAwaitUserConfirmation callback is not called (also tried without callback).

2022-11-25 12:19:10.606 test123[6836:3423487] [AppCenter] VERBOSE: -[MSACDelegateForwarder addTraceBlock:]_block_invoke_2/88 Start buffering traces.
2022-11-25 12:19:10.606 test123[6836:3423487] [AppCenter] DEBUG: -[MSACDelegateForwarder setEnabledFromPlistForKey:]_block_invoke/278 Delegate forwarder for info.plist key 'AppCenterAppDelegateForwarderEnabled' enabled. It may use swizzling.
2022-11-25 12:19:10.606 test123[6836:3423487] [AppCenter] VERBOSE: +[MSACDelegateForwarder flushTraceBuffer]/106 Stop buffering traces, flushed.
2022-11-25 12:19:10.613 test123[6836:3423487] [AppCenterXamarin] DEBUG: +[MSACWrapperLogger MSACWrapperLog:tag:level:]/10 No named identifier found in appSecret; using as-is
2022-11-25 12:19:10.618 test123[6836:3423487] [AppCenter] DEBUG: -[MSACSessionContext init]/42 1 session(s) in the history.
2022-11-25 12:19:10.618 test123[6836:3423487] [AppCenter] VERBOSE: -[MSACSessionContext setSessionId:]/66 Stored new session with id:(null) and timestamp: 2022-11-25 11:19:10 +0000.
2022-11-25 12:19:10.618 test123[6836:3423487] [AppCenter] DEBUG: -[MSACUserIdContext init]/54 1 userId(s) in the history.
2022-11-25 12:19:10.620 test123[6836:3423487] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.
2022-11-25 12:19:10.620 test123[6836:3423487] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.
2022-11-25 12:19:10.620 test123[6836:3423487] [AppCenter] INFO: -[MSACHttpClient networkStateChanged:]/202 Internet connection is up.
2022-11-25 12:19:10.620 test123[6836:3423487] [AppCenter] DEBUG: -[MSACDBStorage initWithSchema:version:filename:]_block_invoke/38 SQLite global configuration successfully updated.
2022-11-25 12:19:10.628 test123[6836:3423487] [AppCenter] INFO: -[MSACAppCenter configureWithAppSecret:transmissionTargetToken:fromApplication:]/350 App Center SDK configured successfully.
2022-11-25 12:19:10.628 test123[6836:3423487] [AppCenter] VERBOSE: -[MSACAppCenter startServices:withAppSecret:transmissionTargetToken:fromApplication:]/376 Start services MSACCrashes, MSACAnalytics from an application
2022-11-25 12:19:10.629 test123[6836:3423487] [AppCenterXamarinCrashes] INFO: +[MSACWrapperLogger MSACWrapperLog:tag:level:]/10 Temporarily remove signal handlers while native crash reporter is initialized (Mono < 4.8).
2022-11-25 12:19:10.629 test123[6836:3423487] [AppCenterCrashes] DEBUG: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/709 EnableUncaughtExceptionHandler is set to NO, we're running in a Xamarin runtime.
2022-11-25 12:19:10.633 test123[6836:3423487] [AppCenterCrashes] DEBUG: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/754 Exception handler successfully initialized but it has not been registered due to the wrapper SDK.
2022-11-25 12:19:10.633 test123[6836:3423487] [AppCenterCrashes] DEBUG: +[MSACApplicationForwarder registerForwarding]/192 Application forwarder for info.plist key 'AppCenterApplicationForwarderEnabled' enabled. It may use swizzling.
2022-11-25 12:19:10.633 test123[6836:3423487] [AppCenterXamarinCrashes] INFO: +[MSACWrapperLogger MSACWrapperLog:tag:level:]/10 Restore signal handlers for Mono < 4.8.
2022-11-25 12:19:10.634 test123[6836:3423487] [AppCenter] VERBOSE: -[MSACSessionContext clearSessionHistoryAndKeepCurrentSession:]/88 Cleared old sessions.
2022-11-25 12:19:10.634 test123[6836:3423487] [AppCenter] VERBOSE: -[MSACUserIdContext clearUserIdHistory]/125 Cleared old userIds while keeping current userId.
2022-11-25 12:19:10.634 test123[6836:3423487] [AppCenterCrashes] INFO: -[MSACCrashes applyEnabledState:]/454 Crashes service has been enabled.
2022-11-25 12:19:10.637 test123[6836:3423487] [AppCenterCrashes] VERBOSE: -[MSACCrashes startWithChannelGroup:appSecret:transmissionTargetToken:fromApplication:]/499 Started crash service.
2022-11-25 12:19:10.638 test123[6836:3423519] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAnalytics: 0x283d84d80> removed from pause lane for channel Analytics.
2022-11-25 12:19:10.638 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics.
2022-11-25 12:19:10.638 test123[6836:3423519] [AppCenter] VERBOSE: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/495 Identifying object <MSACAnalytics: 0x283d84d80> removed from pause lane for channel Analytics/one.
2022-11-25 12:19:10.638 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault resumeWithIdentifyingObjectSync:]/497 Resume channel Analytics/one.
2022-11-25 12:19:10.638 test123[6836:3423487] [AppCenter] VERBOSE: -[MSACSessionContext setSessionId:]/66 Stored new session with id:97066746-3BFC-4BEA-8A75-31E7F4755AB9 and timestamp: 2022-11-25 11:19:10 +0000.
2022-11-25 12:19:10.638 test123[6836:3423487] [AppCenterAnalytics] INFO: -[MSACSessionTracker sendStartSession]/107 New session ID: 97066746-3BFC-4BEA-8A75-31E7F4755AB9
2022-11-25 12:19:10.638 test123[6836:3423487] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/582 Storing a log to Crashes Buffer: (sid: 97066746-3BFC-4BEA-8A75-31E7F4755AB9, type: startSession)
2022-11-25 12:19:10.638 test123[6836:3423487] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/593 Found an empty buffer position.
2022-11-25 12:19:10.638 test123[6836:3423487] [AppCenterAnalytics] INFO: -[MSACAnalytics applyEnabledState:]/182 Analytics service has been enabled.
2022-11-25 12:19:10.638 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault enqueueItem:flags:]_block_invoke/156 Saving log, type: startSession, flags: 1.
2022-11-25 12:19:10.639 test123[6836:3423487] [AppCenterAnalytics] VERBOSE: -[MSACAnalytics startWithChannelGroup:appSecret:transmissionTargetToken:fromApplication:]/133 Started Analytics service.
2022-11-25 12:19:10.639 test123[6836:3423519] [AppCenter] ERROR: +[MSACDBStorage executeNonSelectionQuery:inOpenedDatabase:withValues:]_block_invoke/338 Could not execute the statement, result=5
    database is locked
2022-11-25 12:19:10.639 test123[6836:3423519] [AppCenter] ERROR: +[MSACDBStorage executeQuery:inOpenedDatabase:withValues:usingBlock:]/362 Failed to finalize SQLite statement, result=5
    database is locked
2022-11-25 12:19:10.639 test123[6836:3423487] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/582 Storing a log to Crashes Buffer: (sid: (null), type: startService)
2022-11-25 12:19:10.639 test123[6836:3423487] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/605 Remembering index 0 for oldest timestamp 1669375150.638407.
2022-11-25 12:19:10.639 test123[6836:3423487] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didPrepareLog:internalId:flags:]/593 Found an empty buffer position.
2022-11-25 12:19:10.639 test123[6836:3423519] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didCompleteEnqueueingLog:internalId:]/635 Deleting a log from buffer with id EBC178C9-42EF-446F-8A5E-6751FA3A6839
2022-11-25 12:19:10.639 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault enqueueItem:flags:]_block_invoke/156 Saving log, type: startService, flags: 1.
2022-11-25 12:19:10.640 test123[6836:3423519] [AppCenter] VERBOSE: -[MSACLogDBStorage saveLog:withGroupId:flags:]_block_invoke/130 Log is stored with id: '11'
2022-11-25 12:19:10.640 test123[6836:3423519] [AppCenterCrashes] VERBOSE: -[MSACCrashes channel:didCompleteEnqueueingLog:internalId:]/635 Deleting a log from buffer with id 13F4E538-C5F2-48EC-8648-8716B515CFBE
2022-11-25 12:19:17.005 test123[6836:3423519] [AppCenter] VERBOSE: -[MSACLogDBStorage loadLogsWithGroupId:limit:excludedTargetKeys:completionHandler:]/220 Load log(s) with id(s) '6','8','9','10','11' as batch Id:13A7A2D4-495B-4FCE-9ECA-1B2EA4EA7CDF
2022-11-25 12:19:17.007 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault sendLogContainer:]/191 Sending 1/5 log, group Id: AppCenter, batch Id: 13A7A2D4-495B-4FCE-9ECA-1B2EA4EA7CDF, session Id: (null), payload:
{
  "isOneCollectorEnabled" : false,
  "device" : {
    "appVersion" : "1.0",
    "appBuild" : "1.0",
    "osName" : "iOS",
    "timeZoneOffset" : 60,
    "wrapperSdkVersion" : "5.0.0",
    "osVersion" : "16.1.1",
    "wrapperRuntimeVersion" : "16.0.0",
    "locale" : "en_SK",
    "wrapperSdkName" : "appcenter.xamarin",
    "appNamespace" : "com.test123.test123",
    "osBuild" : "20B101",
    "sdkName" : "appcenter.ios",
    "oemName" : "Apple",
    "sdkVersion" : "5.0.0",
    "model" : "iPhone13,2",
    "screenSize" : "2532x1170"
  },
  "timestamp" : "2022-11-25T11:16:47.966Z",
  "type" : "startService",
  "services" : [
    "Crashes",
    "Analytics"
  ]
}
2022-11-25 12:19:17.007 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault sendLogContainer:]/191 Sending 2/5 log, group Id: AppCenter, batch Id: 13A7A2D4-495B-4FCE-9ECA-1B2EA4EA7CDF, session Id: (null), payload:
{
  "isOneCollectorEnabled" : false,
  "device" : {
    "appVersion" : "1.0",
    "appBuild" : "1.0",
    "osName" : "iOS",
    "timeZoneOffset" : 60,
    "wrapperSdkVersion" : "5.0.0",
    "osVersion" : "16.1.1",
    "wrapperRuntimeVersion" : "16.0.0",
    "locale" : "en_SK",
    "wrapperSdkName" : "appcenter.xamarin",
    "appNamespace" : "com.test123.test123",
    "osBuild" : "20B101",
    "sdkName" : "appcenter.ios",
    "oemName" : "Apple",
    "sdkVersion" : "5.0.0",
    "model" : "iPhone13,2",
    "screenSize" : "2532x1170"
  },
  "timestamp" : "2022-11-25T11:17:11.770Z",
  "type" : "startService",
  "services" : [
    "Crashes",
    "Analytics"
  ]
}
2022-11-25 12:19:17.007 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault sendLogContainer:]/191 Sending 3/5 log, group Id: AppCenter, batch Id: 13A7A2D4-495B-4FCE-9ECA-1B2EA4EA7CDF, session Id: (null), payload:
{
  "isOneCollectorEnabled" : false,
  "device" : {
    "appVersion" : "1.0",
    "appBuild" : "1.0",
    "osName" : "iOS",
    "timeZoneOffset" : 60,
    "wrapperSdkVersion" : "5.0.0",
    "osVersion" : "16.1.1",
    "wrapperRuntimeVersion" : "16.0.0",
    "locale" : "en_SK",
    "wrapperSdkName" : "appcenter.xamarin",
    "appNamespace" : "com.test123.test123",
    "osBuild" : "20B101",
    "sdkName" : "appcenter.ios",
    "oemName" : "Apple",
    "sdkVersion" : "5.0.0",
    "model" : "iPhone13,2",
    "screenSize" : "2532x1170"
  },
  "timestamp" : "2022-11-25T11:17:21.922Z",
  "type" : "startService",
  "services" : [
    "Crashes",
    "Analytics"
  ]
}
2022-11-25 12:19:17.008 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault sendLogContainer:]/191 Sending 4/5 log, group Id: AppCenter, batch Id: 13A7A2D4-495B-4FCE-9ECA-1B2EA4EA7CDF, session Id: (null), payload:
{
  "isOneCollectorEnabled" : false,
  "device" : {
    "appVersion" : "1.0",
    "appBuild" : "1.0",
    "osName" : "iOS",
    "timeZoneOffset" : 60,
    "wrapperSdkVersion" : "5.0.0",
    "osVersion" : "16.1.1",
    "wrapperRuntimeVersion" : "16.0.0",
    "locale" : "en_SK",
    "wrapperSdkName" : "appcenter.xamarin",
    "appNamespace" : "com.test123.test123",
    "osBuild" : "20B101",
    "sdkName" : "appcenter.ios",
    "oemName" : "Apple",
    "sdkVersion" : "5.0.0",
    "model" : "iPhone13,2",
    "screenSize" : "2532x1170"
  },
  "timestamp" : "2022-11-25T11:18:21.179Z",
  "type" : "startService",
  "services" : [
    "Crashes",
    "Analytics"
  ]
}
2022-11-25 12:19:17.008 test123[6836:3423519] [AppCenter] DEBUG: -[MSACChannelUnitDefault sendLogContainer:]/191 Sending 5/5 log, group Id: AppCenter, batch Id: 13A7A2D4-495B-4FCE-9ECA-1B2EA4EA7CDF, session Id: (null), payload:
{
  "isOneCollectorEnabled" : false,
  "device" : {
    "appVersion" : "1.0",
    "appBuild" : "1.0",
    "osName" : "iOS",
    "timeZoneOffset" : 60,
    "wrapperSdkVersion" : "5.0.0",
    "osVersion" : "16.1.1",
    "wrapperRuntimeVersion" : "16.0.0",
    "locale" : "en_SK",
    "wrapperSdkName" : "appcenter.xamarin",
    "appNamespace" : "com.test123.test123",
    "osBuild" : "20B101",
    "sdkName" : "appcenter.ios",
    "oemName" : "Apple",
    "sdkVersion" : "5.0.0",
    "model" : "iPhone13,2",
    "screenSize" : "2532x1170"
  },
  "timestamp" : "2022-11-25T11:19:10.639Z",
  "type" : "startService",
  "services" : [
    "Crashes",
    "Analytics"
  ]
}
2022-11-25 12:19:17.009 test123[6836:3423519] [AppCenter] VERBOSE: -[MSACAppCenterIngestion willSendHTTPRequestToURL:withHeaders:]/101 URL: https://in.appcenter.ms/logs?api-version=1.0.0
2022-11-25 12:19:17.009 test123[6836:3423519] [AppCenter] VERBOSE: -[MSACAppCenterIngestion willSendHTTPRequestToURL:withHeaders:]/102 Headers: Content-Encoding = gzip, Install-ID = 9F3EE1ED-0326-40B3-BA0E-3002F7938A45, Content-Type = application/json, App-Secret = ****************************d924a862
2022-11-25 12:19:17.931 test123[6836:3423511] [AppCenter] VERBOSE: -[MSACHttpIngestion printResponse:body:error:]/229 HTTP response received with status code: 200, payload:
{
  "status" : "Success",
  "correlationId" : "dcded0f4-b2d2-4c3d-be1f-9950b19cb122",
  "validDiagnosticsIds" : [

  ],
  "throttledDiagnosticsIds" : [

  ]
}
2022-11-25 12:19:17.932 test123[6836:3423511] [AppCenter] DEBUG: -[MSACChannelUnitDefault sendLogContainer:]_block_invoke_3/213 Log(s) sent with success, batch Id:13A7A2D4-495B-4FCE-9ECA-1B2EA4EA7CDF.
2022-11-25 12:19:17.943 test123[6836:3423511] [AppCenter] VERBOSE: +[MSACLogDBStorage deleteLogsFromDBWithColumnValues:columnName:inOpenedDatabase:]/357 Deletion of log(s) by id with value(s) '6','8','9','10','11' succeeded.
MikhailSuendukov commented 1 year ago

@marekdovjak We managed to reproduce this issue, so we filed a bug. It will update on progress.

DmitriyKirakosyan commented 1 year ago

Hi @marekdovjak , I checked your demo app. This is actually a bug of net 6/7 iOS. See https://github.com/microsoft/appcenter-sdk-dotnet/issues/1687.

Please use this workaround.

Closing as not an SDK issue.

marekdovjak commented 1 year ago

@DmitriyKirakosyan thanks, it works now!