Xamarin.Android 三星设备上与日期时间相关的崩溃

Xamarin.Android DateTime related crashes on Samsung devices

我们在基于 Xamarin 的跨平台应用程序 Android 上遇到 DateTime parsing/instantiating 相关应用程序崩溃。崩溃仅发生在 Samung 设备上,主要是 Android 8 和 9 的 S8、S8+ 和 Note8。不幸的是,崩溃报告中的堆栈跟踪仅包含几行。遗憾的是,无法联系用户以获取更多信息,因为我们没有任何关于他是谁的信息。

这个问题有不同的表现形式,都有些关联:

使用无效参数调用 DateTime 构造函数

System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
  Module "System.DateTime", line 0, in DateToTicks
    DateToTicks(System.Int32 year, System.Int32 month, System.Int32 day)
  Module "System.DateTime.", line 0, in ctor
    ctor(System.Int32 year, System.Int32 month, System.Int32 day, System.Int32 hour, System.Int32 minute, System.Int32 second)
  Module "System.Threading._ThreadPoolWaitCallback", line 0, in PerformWaitCallback
    PerformWaitCallback()

DateTime 构造函数中的 NullReferenceException

System.NullReferenceException: Object reference not set to an instance of an object
  Module "System.DateTime.", line 0, in ctor
    ctor(System.Int32 year, System.Int32 month, System.Int32 day, System.Int32 hour, System.Int32 minute, System.Int32 second)
  Module "System.Threading._ThreadPoolWaitCallback", line 0, in PerformWaitCallback
    PerformWaitCallback()

但是,也有一些相关的崩溃指向 JSON 库

Json DateTimeParser ParseZone

中的 NullReferenceException
System.NullReferenceException: Object reference not set to an instance of an object
  Module "Newtonsoft.Json.Utilities.DateTimeParser", line 0, in ParseZone
    ParseZone(System.Int32 start)
  Module "Newtonsoft.Json.Utilities.DateTimeParser", line 0, in ParseTimeAndZoneAndWhitespace
    ParseTimeAndZoneAndWhitespace(System.Int32 start)
  Module "System.Threading._ThreadPoolWaitCallback", line 0, in PerformWaitCallback
    PerformWaitCallback()

IndexOutOfRangeException 在 Json DateTimeParser Parse2Digit

System.IndexOutOfRangeException: Index was outside the bounds of the array.
  Module "Newtonsoft.Json.Utilities.DateTimeParser", line 0, in Parse2Digit
    Parse2Digit(System.Int32 start, System.Int32& num)
  Module "System.Threading._ThreadPoolWaitCallback", line 0, in PerformWaitCallback
    PerformWaitCallback()

Json DateTimeParser ParseChar

中的 NullReferenceException
System.NullReferenceException: Object reference not set to an instance of an object
  Module "Newtonsoft.Json.Utilities.DateTimeParser", line 0, in ParseChar
    ParseChar(System.Int32 start, System.Char ch)
  Module "System.Threading._ThreadPoolWaitCallback", line 0, in PerformWaitCallback
    PerformWaitCallback()

这些只是部分崩溃报告,还有一些,但它们都朝着同一个方向发展。

到目前为止我尝试过的:

到目前为止我发现了什么:

有没有人 运行 遇到任何类似的问题或者知道我可以继续关注哪个方向?我完全一无所知,希望得到任何提示。

经过相当多的调查后发现,问题与将 32 位 apk 部署到 64 位设备时在三星设备上的 Xamarin 应用程序中出现的随机 NullReferenceExceptions 有关。由于过去的另一个问题,我们不得不禁用 64 位版本,在解决该问题并再次部署 64 位版本后,我们还没有收到类似的崩溃报告。