Skip to content

[iOS] 16 Beta crash with TextBox #9430

@jeromelaban

Description

@jeromelaban

Current behavior

On iOS 16 beta (20A5328h), all Uno applications will crash when switching between edit fields if some have been prefilled or when repeatedly tapping the same field if it has been filled with any content. The most common screen where this can be seen is on a login screen but it can occur anywhere an application a editable field. This crash has been observed 100% of the time when tapping back and forth between fields multiple times but has also been seen after switching the first time.

Xamarin repro issue: dotnet/macios#15677
Radar issue: https://feedbackassistant.apple.com/feedback/11167044

Similar issues:

Expected behavior

No crash.

How to reproduce it (as minimally and precisely as possible)

Open the gallery application, edit a field or let autofill add some text to the field, notice the app will terminate.

Workaround

The latest Uno.UI bits (4.5 or 4.4.20+) are containing fixes to have TextBox.SelectionChanged to work properly. Until dotnet/macios#15708 gets available for iOS 16, it is required to run apps with --registrar:static when running on iOS Simulators.
It may required to use VS 17.2 or later if using --registrar:static causes issues such as :

  • registrar.m(46261,37): error GC04982C4: expected a type
  • registrar.m(46255,53): error GA3D0CE9E: type arguments cannot be applied to non-parameterized class 'NSObject'

If you are facing this issue

Works on UWP/WinUI

No response

Environment

No response

NuGet package version(s)

4.4.13

Affected platforms

iOS

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

Crash log (2022-08-05_13-01-53.8928_-0400-72ea751442b0e0efb8bd0f525826eb068c08aea2.txt):

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCountableTextLocation compare:] receiving unmatching type (null)'


Incident Identifier: AD6D43DF-A56D-48FE-B0DC-14EFCE9010BA
Hardware Model:      iPhone11,2
Process:             Uno.Gallery.Mobile [69324]
Path:                /private/var/containers/Bundle/Application/7E56AE9B-FE7F-4111-87A7-CE35303EAEA5/Uno.Gallery.Mobile.app/Uno.Gallery.Mobile
Identifier:          com.nventive.uno.gallery-canary
Version:             1.5.0 (2208050208.911)
AppStoreTools:       13F100
AppVariant:          1:iPhone11,2:15
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.nventive.uno.gallery-canary [756]

Date/Time:           2022-08-05 13:01:53.8928 -0400
Launch Time:         2022-08-05 13:01:41.7660 -0400
OS Version:          iPhone OS 16.0 (20A5328h)
Release Type:        Beta
Baseband Version:    4.50.03
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016b787ee0
Exception Codes: 0x0000000000000002, 0x000000016b787ee0
VM Region Info: 0x16b787ee0 is in 0x16b784000-0x16b788000;  bytes after start: 16096  bytes before end: 287
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_SMALL             14c800000-14d000000 [ 8192K] rw-/rwx SM=PRV  
      GAP OF 0x1e784000 BYTES
--->  STACK GUARD              16b784000-16b788000 [   16K] ---/rwx SM=NUL  ... for thread 0
      Stack                    16b788000-16b884000 [ 1008K] rw-/rwx SM=PRV  thread 0
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [69324]

Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                	0x1ba729db8 __exceptionPreprocess + 164 (NSException.m:202)
1   libobjc.A.dylib               	0x1b3b93a68 objc_exception_throw + 60 (objc-exception.mm:356)
2   CoreFoundation                	0x1ba819760 +[NSException raise:format:] + 112 (NSException.m:0)
3   UIFoundation                  	0x1c1f38a30 -[NSCountableTextLocation compare:] + 204 (NSTextRange.m:212)
4   UIFoundation                  	0x1c1f4adcc __44-[NSTextLayoutManager ensureLayoutForRange:]_block_invoke_2 + 44 (NSTextLayoutManager.m:1675)
5   UIFoundation                  	0x1c1f4d330 __83-[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:]_block_invoke_2 + 536 (NSTextLayoutManager.m:2080)
6   CoreFoundation                	0x1ba72a2d0 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSArrayHelpers.m:10)
7   CoreFoundation                	0x1ba757438 -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 92 (NSSingleObjectArray.m:54)
8   UIFoundation                  	0x1c1f4d000 __83-[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:]_block_invoke + 776 (NSTextLayoutManager.m:2031)
9   UIFoundation                  	0x1c1f376c8 -[NSTextContentStorage enumerateTextElementsFromLocation:options:usingBlock:] + 3876 (NSTextContentManager.m:1499)
10  UIFoundation                  	0x1c1f36678 -[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:] + 576 (NSTextLayoutManager.m:2121)
11  UIFoundation                  	0x1c1f4c6d4 -[NSTextLayoutManager ensureLayoutForRange:] + 208 (NSTextLayoutManager.m:1671)
12  UIKitCore                     	0x1be592198 -[_UITextKit2LayoutController insertionRectForPosition:typingAttributes:placeholderAttachment:textContainer:] + 284 (_UITextKit2LayoutController.m:250)
13  UIKitCore                     	0x1bded3d0c -[UITextInputController caretRectForPosition:] + 164 (UITextInputController.m:2446)
14  UIKitCore                     	0x1bded3bd0 -[UIFieldEditor caretRectForPosition:] + 64 (UIFieldEditor.m:1655)
15  UIKitCore                     	0x1bded3b28 -[UITextField caretRectForPosition:] + 64 (UITextField.m:7548)
16  UIKitCore                     	0x1bde426b0 -[UITextSelection caretRect] + 108 (UITextSelection.m:155)
17  UIKitCore                     	0x1beae51ac -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) scrollSelectionToVisible:] + 536 (UITextInteractionAssistant.m:1490)
18  UIKitCore                     	0x1be8213b0 -[_UIKeyboardTextSelectionController scrollSelectionToVisible] + 80 (_UIKeyboardTextSelectionController.m:0)
19  UIKitCore                     	0x1be822818 -[_UIKeyboardTextSelectionController selectTextWithGranularity:atPoint:executionContext:] + 812 (_UIKeyboardTextSelectionController.m:551)
20  UIKitCore                     	0x1be8228bc -[_UIKeyboardTextSelectionController selectTextWithGranularity:atPoint:completionHandler:] + 72 (_UIKeyboardTextSelectionController.m:559)
21  UIKitCore                     	0x1beacdd1c -[UITextSelectionInteraction tappedToSelectTextWithGesture:atPoint:granularity:completionHandler:] + 96 (UITextSelectionInteraction.m:454)
22  UIKitCore                     	0x1beacd828 -[UITextSelectionInteraction _checkForRepeatedTap:gestureLocationOut:] + 508 (UITextSelectionInteraction.m:351)
23  UIKitCore                     	0x1beace168 -[UITextSelectionInteraction _handleMultiTapGesture:] + 712 (UITextSelectionInteraction.m:565)
24  UIKitCore                     	0x1bde5bc20 -[UIApplication sendAction:to:from:forEvent:] + 132 (UIPerformVoidSelector.h:58)
25  UIKitCore                     	0x1be5499c0 -[UITextMultiTapRecognizer onStateUpdate:] + 280 (UITextMultiTapRecognizer.m:62)
26  UIKitCore                     	0x1bdccb084 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 156 (UIPerformVoidSelector.h:50)
27  UIKitCore                     	0x1be0395b0 _UIGestureRecognizerSendTargetActions + 92 (UIGestureRecognizer.m:1514)
28  UIKitCore                     	0x1bddb3088 _UIGestureRecognizerSendActions + 272 (UIGestureRecognizer.m:1553)
29  UIKitCore                     	0x1bdc93058 -[UIGestureRecognizer _updateGestureForActiveEvents] + 528 (UIGestureRecognizer.m:0)
30  UIKitCore                     	0x1bdd3f6dc _UIGestureEnvironmentUpdate + 2436 (UIGestureEnvironment.m:198)
31  UIKitCore                     	0x1be5bb4e8 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 288 (UIGestureEnvironment.m:1376)
32  UIKitCore                     	0x1bdd03c80 -[UIGestureEnvironment _updateForEvent:window:] + 188 (UIGestureEnvironment.m:1345)
33  UIKitCore                     	0x1bdd085d8 -[UIWindow sendEvent:] + 3268 (UIWindow.m:3471)
34  UIKitCore                     	0x1bdd078a8 -[UIApplication sendEvent:] + 672 (UIApplication.m:12473)
35  UIKitCore                     	0x1bdd06f64 __dispatchPreprocessedEventFromEventQueue + 7084 (UIEventDispatcher.m:2375)

closes https://github.com/unoplatform/nventive-private/issues/409

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't workingplatform/ios 🍎Categorizes an issue or PR as relevant to the iOS platformproject/core-tools 🛠️Categorizes an issue or PR as relevant to core and tools

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions