Description
@jfversluis ... I am also running into this issue.
Using net8.0-ios... This is currently halting my port to MAUI from going to production. It is very weird as the only way I can reliably reproduce it is this:
high level app UI>>>: List page with drill down to detail page.
---updated this to simplify after what I found:
To replicate follow this:
- start at list and drill down to a detail page
- click on a field to bring up the Keyboard/Picker/any iOS native UI
- navigate back to list page... and then go into detail page again.
Looking at the call stack below... it seems to occur on a UITextView... drilling in...
YOU ARE NOT GOING TO BELIEVE THIS...
my field is populated from a DB and it has a double dash -- in it...
- what the system does is the first time, there is no issues... is displays the double dash as 2 characters...
- if you click on ANY field to bring up the keyboard... in my case, I consider it dirty and save as I navigate back.
- it then converts that double dash to a special long dash
- next time in, it barfs with the error below as it tries to show the special character.
SOO... after all this... it seems it is definitely a result of having some special characters in a field... in combination with having previously brought up a keyboard/Picker/ any type of iOS native dialog
P.S.> I tested Char(10) and Char(13) and no issues with them... I don't know how many other types of special character combinations exist...
regardless... this needs to be fixed.
Value cannot be null. (Parameter 'fromPosition')
----------
at ObjCRuntime.ThrowHelper.ThrowArgumentNullException(String argumentName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/ThrowHelper.cs:line 28
at ObjCRuntime.NativeObjectExtensions.GetNonNullHandle(INativeObject self, String argumentName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/INativeObject.cs:line 42
at UIKit.UITextView.GetTextRange(UITextPosition fromPosition, UITextPosition toPosition) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/UITextView.g.cs:line 565
at Microsoft.Maui.Platform.TextInputExtensions.SetTextRange(IUITextInput platformView, Int32 start, Int32 selectedTextLength)
at Microsoft.Maui.Controls.Platform.TextExtensions.UpdateText(IUITextInput textInput, InputView inputView, Boolean isEditing)
at Microsoft.Maui.Controls.Platform.TextExtensions.UpdateText(UITextView textView, InputView inputView)
at Microsoft.Maui.Controls.Editor.MapText(IEditorHandler handler, Editor editor)
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass2_0`2[[Microsoft.Maui.Controls.Editor, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IEditorHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<ReplaceMapping>b__0(IEditorHandler h, Editor v, Action`2 p)
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass1_0`2[[Microsoft.Maui.Controls.Editor, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IEditorHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<ModifyMapping>g__newMethod|0(IElementHandler handler, IElement view)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IEditor, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IEditorHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.PropertyMapper.UpdateProperty(IElementHandler viewHandler, IElement virtualView, String property)
at Microsoft.Maui.Handlers.ElementHandler.UpdateValue(String property)
at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity)
at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget)
at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.<PropertyChanged>b__50_0()
at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action)
at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.PropertyChanged(Object sender, PropertyChangedEventArgs args)
at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
at CommunityToolkit.Mvvm.ComponentModel.ObservableObject.OnPropertyChanged(PropertyChangedEventArgs e)
at CommunityToolkit.Mvvm.ComponentModel.ObservableObject.OnPropertyChanged(String propertyName)
at CommunityToolkit.Mvvm.ComponentModel.ObservableObject.SetProperty[WODetails](WODetails& field, WODetails newValue, String propertyName)
at SOSMobile.WorkOrders.WorkOrderDetailViewModel.set_WOInfo(WODetails value) in C:\Source\net8\SOSMobile\Features\WorkOrders\WorkOrderDetailViewModel.cs:line 40
at SOSMobile.WorkOrders.WorkOrderDetailViewModel.RefreshData() in C:\Source\net8\SOSMobile\Features\WorkOrders\WorkOrderDetailViewModel.cs:line 138
Originally posted by @ppereira-serviceonsites in #15937 (comment)