You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exceptions thrown in TargetTypeConverter crash the whole app, instead of being caught into control's Data Validation.
To Reproduce
<TextBox Text="{CompiledBinding Value}" />
where Value is an int - and type a letter.
Unhandled exception. System.ArgumentException: 0a is not a valid value for Int32. (Parameter 'value')
---> System.FormatException: The input string '0a' was not in a correct format.
at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo)
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at Avalonia.Data.Core.TargetTypeConverter.DefaultConverter.TryConvert(Object value, Type type, CultureInfo culture, Object& result)
at Avalonia.Data.Core.BindingExpression.WriteValueToSource(Object value)
at Avalonia.Data.Core.BindingExpression.OnTargetPropertyChanged(Object sender, AvaloniaPropertyChangedEventArgs e)
at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority, Boolean isEffectiveValue)
at Avalonia.PropertyStore.EffectiveValue`1.SetAndRaiseCore(ValueStore owner, StyledProperty`1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue)
at Avalonia.PropertyStore.EffectiveValue`1.SetCurrentValueAndRaise(ValueStore owner, StyledProperty`1 property, T value)
at Avalonia.PropertyStore.ValueStore.SetCurrentValue[T](StyledProperty`1 property, T value)
at Avalonia.AvaloniaObject.SetCurrentValue[T](StyledProperty`1 property, T value)
at Avalonia.Controls.TextBox.HandleTextInput(String input)
at Avalonia.Controls.TextBox.OnTextInput(TextInputEventArgs e)
at Avalonia.Input.InputElement.<>c.<.cctor>b__32_4(InputElement x, TextInputEventArgs e)
at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value)
at Avalonia.Interactivity.RoutedEvent.InvokeRaised(Object sender, RoutedEventArgs e)
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
at Avalonia.Input.KeyboardDevice.ProcessRawEvent(RawInputEventArgs e)
at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e)
at Avalonia.Controls.TopLevel.<>c.<HandleInput>b__141_0(Object state)
at Avalonia.Threading.Dispatcher.Send(SendOrPostCallback action, Object arg, Nullable`1 priority)
at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e)
at Avalonia.Native.WindowBaseImpl.RawTextInputEvent(UInt64 timeStamp, String text)
at Avalonia.Native.WindowBaseImpl.WindowBaseEvents.Avalonia.Native.Interop.IAvnWindowBaseEvents.RawTextInputEvent(UInt64 timeStamp, String text)
at Avalonia.Native.Interop.Impl.__MicroComIAvnWindowBaseEventsVTable.RawTextInputEvent(Void* this, UInt64 timeStamp, Byte* text)
--- End of stack trace from previous location ---
at Avalonia.Native.DispatcherImpl.RunLoop(CancellationToken token)
at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action`1 lifetimeBuilder)
at AvaloniaBugs.Program.Main(String[] args) in /AvaloniaBugsAll/bug_type_converter/AvaloniaBugs/Program.cs:line 12
Describe the bug
Exceptions thrown in TargetTypeConverter crash the whole app, instead of being caught into control's Data Validation.
To Reproduce
where Value is an
int
- and type a letter.or
git clone https://github.com/BAndysc/avalonia-bugs-repro
git checkout bug_type_converter
Expected behavior
No crash, like before binding refactor.
Avalonia version
11.1-beta
OS
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: