Xamarin.Forms 应用程序在 iOS 更新到 13.1 后崩溃
Xamarin.Forms App crash on iOS after updating to 13.1
我在 mac 上使用 Visual Studio 2017 和 Visual Studio 2017。 Mono 版本是 5.18.1,Xamarin.iOS 版本是 12.4(我认为)。该应用程序运行良好,没有任何问题。最近我已经将 Windows 和 Mac 上的 Visual Studios 更新到 2019,并且 Xamarin.iOS 版本已经更新到 13.4。现在,该应用程序在两个模拟器和 iPhone 与 iOS 13.1 上都有 'weird' 崩溃。但在 iOS 12.4 的模拟器上,该应用程序运行流畅。此外,应用程序商店中发布的应用程序(使用 Xamarin.iOS 12.4 构建)在 iOS 13.1 设备中运行正常。
应用程序在执行一些与动画相关的工作时似乎崩溃了,这是来自 AppCenter 的崩溃日志。
Application Specific Information:
*** Terminating app due to uncaught exception 'SIGABRT', reason: 'Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
Native stack trace:
**some native trace**
Xamarin Exception Stack:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
Native stack trace:
**some native trace**
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:406
at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/runtime/Delegates.generated.cs:128
at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper(intptr,intptr)
at UIKit.UIView.LayoutSubviews () [0x00023] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIView.g.cs:1290
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].LayoutSubviews () [0x00000] in D:\a\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:289
at null.null
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper(intptr,intptr)
at UIKit.UIView.LayoutSubviews () [0x00023] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIView.g.cs:1290
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].LayoutSubviews () [0x00000] in D:\a\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:289
at null.null
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend(intptr,intptr)
at CoreAnimation.CATransaction.Commit () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/CATransaction.g.cs:90
at Xamarin.Forms.Platform.iOS.CADisplayLinkTicker.StartThread () [0x0003a] in D:\a\s\Xamarin.Forms.Platform.iOS\CADisplayLinkTicker.cs:61
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/thread.cs:74
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:899
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/thread.cs:111
有谁知道这里的问题是什么? :(
不知何故,当我从与崩溃相关的视图中删除 Xamarin.Forms.Editor
时,没有发生崩溃。我想如果我的代码没有做某事,那么渲染器 (EditorRenderer) 可能负责在后台线程或其他东西上更新 UI。所以我稍微更新了 Xamarin.Forms
版本,它起作用了。
所以将 Xamarin.Forms 版本更新到 3.6 解决了这个问题!
我在 mac 上使用 Visual Studio 2017 和 Visual Studio 2017。 Mono 版本是 5.18.1,Xamarin.iOS 版本是 12.4(我认为)。该应用程序运行良好,没有任何问题。最近我已经将 Windows 和 Mac 上的 Visual Studios 更新到 2019,并且 Xamarin.iOS 版本已经更新到 13.4。现在,该应用程序在两个模拟器和 iPhone 与 iOS 13.1 上都有 'weird' 崩溃。但在 iOS 12.4 的模拟器上,该应用程序运行流畅。此外,应用程序商店中发布的应用程序(使用 Xamarin.iOS 12.4 构建)在 iOS 13.1 设备中运行正常。
应用程序在执行一些与动画相关的工作时似乎崩溃了,这是来自 AppCenter 的崩溃日志。
Application Specific Information:
*** Terminating app due to uncaught exception 'SIGABRT', reason: 'Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
Native stack trace:
**some native trace**
Xamarin Exception Stack:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
Native stack trace:
**some native trace**
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:406
at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/runtime/Delegates.generated.cs:128
at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper(intptr,intptr)
at UIKit.UIView.LayoutSubviews () [0x00023] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIView.g.cs:1290
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].LayoutSubviews () [0x00000] in D:\a\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:289
at null.null
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper(intptr,intptr)
at UIKit.UIView.LayoutSubviews () [0x00023] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIView.g.cs:1290
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].LayoutSubviews () [0x00000] in D:\a\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:289
at null.null
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend(intptr,intptr)
at CoreAnimation.CATransaction.Commit () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/CATransaction.g.cs:90
at Xamarin.Forms.Platform.iOS.CADisplayLinkTicker.StartThread () [0x0003a] in D:\a\s\Xamarin.Forms.Platform.iOS\CADisplayLinkTicker.cs:61
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/thread.cs:74
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:899
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/threading/thread.cs:111
有谁知道这里的问题是什么? :(
不知何故,当我从与崩溃相关的视图中删除 Xamarin.Forms.Editor
时,没有发生崩溃。我想如果我的代码没有做某事,那么渲染器 (EditorRenderer) 可能负责在后台线程或其他东西上更新 UI。所以我稍微更新了 Xamarin.Forms
版本,它起作用了。
所以将 Xamarin.Forms 版本更新到 3.6 解决了这个问题!