Writing 'سلام' has error in TextBox


when i trying to write this word 'سلام دنیا' or 'سلام' an error occured by this message :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List1.get_Item(Int32 index)
at NBidi.NBidi.Paragraph.InternalCompose(StringBuilder target, List
1 char_lengths)
at NBidi.NBidi.Paragraph.NormalizeText()
at NBidi.NBidi.Paragraph.set_Text(String value)
at NBidi.NBidi.Paragraph..ctor(String text)
at NBidi.NBidi.SplitStringToParagraphs(String logicalString)
at NBidi.NBidi.LogicalToVisual(String logicalString, Int32[]& indexes, Int32[]& lengths)
at NBidi.NBidi.VisualToLogicalPosition(String logicalOrigStringNoRLM, Int32 visualPosition)
at System.Windows.BidiControls.TextBox.onInternalTextChanged(Object sender, TextChangedEventArgs e)
at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Is There any Idea to Fix it ?

file attachments


satabrizi wrote Jul 21, 2009 at 10:46 AM

I'v sl3 and vs2008sp1 on vista sp2 .

wrote Dec 27, 2009 at 7:59 AM

wrote Mar 20, 2010 at 2:32 PM

mabdulhadi wrote Mar 21, 2010 at 1:24 PM

I tried to fix it by downloading updated NBidi Algorithm (v1.2.1.1) from http://sourceforge.net/projects/nbidi/ and updating the code files in Nbidi Folder of System.Windows.BidiControls. It do solve the problem of throwing exception when you write "سلام دنيا" but unfortunately it do changes it to "سلما دنيا". Upon further testing I was relieved to find out that if you copy "سلام دنيا" and paste it into a text box it shows correctly.

I think it is same problem as that of writing "المالكى" where you have to put a space between each "Alif" and "Laam".

I am attaching updated Code. Please vote the post if you find it useful.

For people not having Arabic Keyboard (after adding standard Arabic 101 keyboard) can press "sghl ]kdh" to type "سلام دنيا"

wrote Mar 21, 2010 at 1:24 PM

wrote Feb 12, 2013 at 10:31 PM