-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] 16 Beta crash with TextBox #9430
Comments
Update: This issue is related to the handling of the selected text, where simply overring the uno/src/Uno.UI/UI/Xaml/Controls/TextBox/SinglelineTextBoxView.iOS.cs Lines 217 to 233 in 5502f73
This feature is critical to the handling of |
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
Update: Re-creating the crashing UITextField code in SwiftUI does not repro the issue, but reproducing using Xamarin.iOS does: xamarin/xamarin-macios#15677 |
A workaround has been published, see notes in the original post. |
@jeromelaban Since we can override (in the general, not the C#, way) the problematic property then it hints to a bug inside Microsoft's SDK. Kind of weird since it's a very simple signature (to call or be called from) and it's used in so many places... Anyway you should be able to use the uno/src/Uno.UI/UI/Xaml/Controls/TextBox/SinglelineTextBoxView.iOS.cs Lines 217 to 233 in 5502f73
It's still a workaround - but it would be one that would not impact the (recompiled) apps. Update: requires the static registrar to be enabled (not the default for simulator builds as it impact build times). Filed as xamarin/xamarin-macios#15708 |
xamarin/xamarin-macios#15712 once merged, should make this easier on developers. |
While looking at my PR failures I found out that
That one likely suffers from the same issue and need a similar workaround against crashes on iOS 16. Also |
I've just validated and indeed |
Update: iOS 16 Beta 7 does not fix the issue. |
An additional workaround was implemented in #9559 |
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
BREAKING CHANGE: On iOS, when running under the iOS Simulator, the `MtouchExtraArgs` property must include `--registrar=static` or the runtime will fail with the following message: ``` Don't know how to marshal a return value of type 'System.IntPtr'. ``` See #9430 for more details.
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
BREAKING CHANGE: On iOS, when running under the iOS Simulator, the `MtouchExtraArgs` property must include `--registrar=static` or the runtime will fail with the following message: ``` Don't know how to marshal a return value of type 'System.IntPtr'. ``` This validation can be disabled by setting the MSBuild property: ```xml <PropertyGroup> <UnoDisableValidateIOSStaticRegistrar>true</UnoDisableValidateIOSStaticRegistrar> </PropertyGroup> ``` See #9430 for more details.
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
BREAKING CHANGE: On iOS, when running under the iOS Simulator, the `MtouchExtraArgs` property must include `--registrar=static` or the runtime will fail with the following message: ``` Don't know how to marshal a return value of type 'System.IntPtr'. ``` This validation can be disabled by setting the MSBuild property: ```xml <PropertyGroup> <UnoDisableValidateIOSStaticRegistrar>true</UnoDisableValidateIOSStaticRegistrar> </PropertyGroup> ``` See #9430 for more details. (cherry picked from commit 5a76347)
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
…with UITextField This change is needed to make the SinglelineTextBoxView.SelectedTextRange conditional, and avoid changing the value provided to UIKit. This breaks the use of `TextBoxSelectionChanged`, but can be restored by using the `FeatureConfiguration.TextBox.IOS16EnableSelectionSupport` feature flag if the issue ends up being fixed in UIKit. See #9430 for more details.
Crash log
|
@Daoting Please see https://github.com/unoplatform/uno/blob/release/stable/4.5/doc/articles/get-started-wizard.md/#dont-know-how-to-marshal-a-return-value-of-type-systemintptr
|
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: xamarin/xamarin-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 haveTextBox.SelectionChanged
to work properly. Until xamarin/xamarin-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):
closes https://github.com/unoplatform/nventive-private/issues/409
The text was updated successfully, but these errors were encountered: