Component: SignaturePad
Version: Telerik UI for .NET MAUI 12.0.0 .NET: .NET 10 / .NET MAUI
Platform: Reproduced on iOS (iPad, iPhone) and Android (Samsung). Cross-platform — bug is in the shared SingleTouchSegmentProvider, not in a platform-specific touch handler.
RadSignaturePad crashes the app with an unhandled InvalidOperationException: "Sequence contains no elements" thrown from the touch event pipeline. Because the exception originates inside the native→managed touch callback, it cannot be caught by user code and propagates to AppDomain.CurrentDomain.UnhandledException, terminating the app.
The root cause is a .Last() call on an empty segment collection inside SingleTouchSegmentProvider.OnTouch. The crash occurs in both TouchesMoved and TouchesEnded paths, indicating a missing guard at the central OnTouch entry point — not in a specific touch phase.
RadSignaturePad and a separate button that invokes signaturePad.ClearCommand.→ TouchesMoved fires after ClearCommand has emptied the internal segment collection. SingleTouchSegmentProvider.OnTouch calls .Last() on the empty collection and throws.
Reproduced on:
The same crash also occurs on TouchesEnded in less deterministic scenarios — palm rejection, multi-touch cancellation, Apple Pencil hover-to-touch transitions, or a touch that begins outside the view and ends inside it. All of these can deliver a touch event without a corresponding active segment. We've observed this variant in production on iPad but could not reliably reproduce it in isolation.
System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.Last[Segment](IEnumerable`1 source)
at Telerik.Maui.Controls.SignaturePad.SingleTouchSegmentProvider.OnTouch(InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignaturePad.SegmentProvider.TouchRecognizer_Touch(Object sender, InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignatureView.OnTouch(InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignatureViewHandler.<ConnectHandler>b__3_0(InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignaturePad.SignatureViewTouchHandler.FireEvent(InteractionAction actionType, UITouch touch)
at Telerik.Maui.Controls.SignaturePad.SignatureViewTouchHandler.TouchesMoved(NSSet touches, UIEvent evt)
at Telerik.Maui.Controls.SignaturePad.SignatureViewTouchHandler.__Registrar_Callbacks__.callback_1171_..._TouchesMoved(IntPtr pobj, IntPtr sel, IntPtr p0, IntPtr p1, IntPtr* exception_gchandle)
System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.Last[Segment](IEnumerable`1 source)
at Telerik.Maui.Controls.SignaturePad.SingleTouchSegmentProvider.OnTouch(InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignaturePad.SegmentProvider.TouchRecognizer_Touch(Object sender, InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignatureView.OnTouch(InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignatureViewHandler.<ConnectHandler>b__3_0(InteractionAdapterEventArgs args)
at Telerik.Maui.Controls.SignaturePad.SignatureViewTouchHandler.FireEvent(InteractionAction actionType, UITouch touch)
at Telerik.Maui.Controls.SignaturePad.SignatureViewTouchHandler.TouchesEnded(NSSet touches, UIEvent evt)
at Telerik.Maui.Controls.SignaturePad.SignatureViewTouchHandler.__Registrar_Callbacks__.callback_1162_..._TouchesEnded(IntPtr pobj, IntPtr sel, IntPtr p0, IntPtr p1, IntPtr* exception_gchandle)
<telerik:RadSignaturePad
x:Name="signaturePad"
StrokeThickness="5"
StrokeColor="Black"
BackgroundColor="White" />
<Button Text="Clear" Clicked="OnClearClicked" />
void OnClearClicked(object s, EventArgs e)
{
if (signaturePad.ClearCommand.CanExecute(null))
signaturePad.ClearCommand.Execute(null);
}
No custom touch handlers, no SegmentProvider override, no gestures attached.
SingleTouchSegmentProvider.OnTouch should guard against an empty segment collection (e.g. .LastOrDefault() + null check, or an early return when no active segment exists). Touch events arriving after a Clear — or without a preceding TouchesBegan — should be ignored, not throw.
We disable the Clear button while a stroke is active (toggled in StrokeStarted / StrokeCompleted). This closes the deterministic repro but does not cover the non-deterministic TouchesEnded cases (palm rejection etc.), which still crash. A fix in SingleTouchSegmentProvider.OnTouch is required.
App crash on a customer-visible workflow (digital signature capture on service tickets). Affects production users on iPads, iPhones, and Android devices.
SignatureViewTouchHandler or SegmentProvider so we can guard OnTouch from user code?