This is a migrated thread and some comments may be shown as answers.

Index was outside the bounds of the array

5 Answers 1292 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Roar
Top achievements
Rank 1
Roar asked on 31 May 2011, 07:56 AM
Hi,

I'm trying to use the RadMaskedNumericInput as follows;

<telerik:RadMaskedNumericInput
                Grid.Row="6"
                Grid.Column="1"
                Value="{Binding Mileage}"
                EmptyContent="kilometer"
                FormatString="D"
                Mask="d"
                IsClearButtonVisible="False"
                VerticalAlignment="Center"
                VerticalContentAlignment="Center"
                />

...where the bound 'Mileage'-property is an Int. But when I try to input a number at runtime, I get the following exception;

"Index was outside the bounds of the array."

And the stacktrace;

   at System.String.get_Chars(Int32 index)
   at Telerik.Windows.Controls.RadMaskedNumericInput.GetValidCharOverride(Char ch, Int32& position, Nullable`1 forwardSpin, Boolean& isValid) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedNumericInput.cs:line 625
   at Telerik.Windows.Controls.RadMaskedInputBase.ProcessChar(Char ch, Int32& position, Nullable`1 forwardSpin) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2693
   at Telerik.Windows.Controls.RadMaskedInputBase.ProcessChar(Char ch, Int32 position, TokenTypes type, Nullable`1 forward, Nullable`1 forwardSpin) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2641
   at Telerik.Windows.Controls.RadMaskedInputBase.ProcessKey(Char ch, KeyEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 1548
   at Telerik.Windows.Controls.RadMaskedInputBase.OnKeyDownHandled(Char c) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 476
   at Telerik.Windows.Controls.MaskedInput.PreviewInputTextBox.OnTextInput(TextCompositionEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\PreviewInputTextBox.cs:line 44
   at System.Windows.UIElement.OnTextInputThunk(Object sender, TextCompositionEventArgs e)
   at System.Windows.Input.TextCompositionEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.TextCompositionManager.UnsafeCompleteComposition(TextComposition composition)
   at System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)
   at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.TextCompositionManager.UnsafeStartComposition(TextComposition composition)
   at System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)
   at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessTextInputAction(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
   at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
.... 

5 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 31 May 2011, 09:05 AM
Hi Roar,

What version are you using to test this. I tested this with the latest ones and I cannot seem to reproduce this exception. Thank you.

Regards,
Alex Fidanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Peter
Top achievements
Rank 1
Iron
commented on 12 Jan 2024, 10:20 PM

Oh man. I find this VERY frustrating. I added a couple lines of xaml...I get this exact same error! WTF! Then...after trying a few things out, googling a few things......hhhmmm....close and reload the solution. POOF! Goes away.

 

Come on guys! WTF? Really? Stuff like this, inconsistencies LIKE THIS are what make me distrust your product. You need to do better.

 

PS Telling someone "oh, I don't get that error" is NOT helpful! Actually, it only serves to make me angrier. Think "the Hulk" angry actually and you're in the right ball park of frustration you cause by that comment.

0
Ivano
Top achievements
Rank 1
answered on 19 Apr 2012, 08:49 AM
Hi

same issue on lastest version when setting Mask='d' or 'n'; even the demo has it.
I need support for integers or floating points input; I think the way is setting mask to 'D' for integers and 'N' for floating point numbers.

Sincerely
Ivano
0
Alex Fidanov
Telerik team
answered on 23 Apr 2012, 08:52 AM
Hi Ivano,

 I am still not able to reproduce this. However, what you can try is using the '#' token, which is a non-required numeric token.

All the best,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ivano
Top achievements
Rank 1
answered on 02 May 2012, 02:04 PM
Hi,
open your demo (more masket input examples); choose Numeric Input) and put "D" or "N" in the mask field; the issue is related to capital letters. Setting "n" or "d" you don't get any error but input is limited to one digit (?)
Anyway which mask setting for integers and floating point number?

Sincerely
Ivano
0
Tina Stancheva
Telerik team
answered on 07 May 2012, 03:17 PM
Hello Ivano,

You can find a list of mask tokens here. I hope it will help, still let us know if you need more info.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Roar
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Ivano
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or