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

Update to hyperlink causes exception

1 Answer 89 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael MSTG
Top achievements
Rank 1
Michael MSTG asked on 04 Jun 2012, 07:43 PM

This is via the 2011.3.1116.1040 release.

We were attempting to update a record being displayed via the rich text box that has a hyperlink embedded in the text.  We simply tried to update the hyperlink to the URL "https://@authorizeuserurl" and when we click OK we got the following exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Documents.Model.RadDocument.IsInRange(HierarchicalIndex inlineIndex, AnnotationRangeStart rangeStart)
   at Telerik.Windows.Documents.Model.RadDocument.GetFieldStart(Inline inline)
   at Telerik.Windows.Documents.Model.Inline.get_FieldStart()
   at Telerik.Windows.Documents.Model.RadDocument.IsValidPosition(DocumentPosition p)
   at Telerik.Windows.Documents.Model.RadDocument.EnsureValidPositionCallback(DocumentPosition p, Func`1 IsMoveForward)
   at Telerik.Windows.Documents.DocumentPosition.ResumePositionValidation()
   at Telerik.Windows.Documents.Model.RadDocument.ExecuteCommand(CommandBase command, DocumentCommandContext context)
   at Telerik.Windows.Controls.RadRichTextBox.InsertHyperlink(HyperlinkInfo hyperlinkInfo, String hyperlinkText, StyleDefinition hyperlinkStyle)
   at Telerik.Windows.Controls.RadRichTextBox.<ShowInsertHyperlinkDialog>b__24(String linkText, HyperlinkInfo linkInfo)
   at Telerik.Windows.Controls.RichTextBoxUI.Dialogs.RadInsertHyperlinkDialog.OnOkClicked()
   at Telerik.Windows.Controls.RichTextBoxUI.Dialogs.RadInsertHyperlinkDialog.buttonOK_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at Telerik.Windows.Controls.RadButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

When we click on cancel, this error:

System.InvalidOperationException: inline does not belong to this document.
   at Telerik.Windows.Documents.Model.RadDocument.IsInAnnotationRange[TRangeStart](Inline inline, Predicate`1 filter, Boolean inclusive)
   at Telerik.Windows.Documents.Commands.UndoableCommandBase.CanExecuteRespectingReadOnlyRanges(RadDocument document)
   at Telerik.Windows.Documents.RichTextBoxCommands.RichTextBoxCommandBase.UpdateCanExecute()
   at Telerik.Windows.Documents.RichTextBoxCommands.ContextListeners.DocumentContextListener.ContextChangedEventHandler(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Telerik.Windows.Documents.DocumentPosition.OnPositionChanged()
   at Telerik.Windows.Documents.DocumentPosition.MoveToPosition(DocumentPosition newPosition)
   at Telerik.Windows.Controls.RadRichTextBox.<>c__DisplayClass28.<ShowInsertHyperlinkDialog>b__25()
   at Telerik.Windows.Controls.RichTextBoxUI.Dialogs.RadInsertHyperlinkDialog.RadWindow_Closed(Object sender, WindowClosedEventArgs e)
   at Telerik.Windows.Controls.RadWindow.OnClosed(WindowClosedEventArgs args)
   at Telerik.Windows.Controls.RadWindow.OnClosed()
   at Telerik.Windows.Controls.WindowBase.TryClose(Boolean shouldCloseHost)
   at Telerik.Windows.Controls.RichTextBoxUI.Dialogs.RadInsertHyperlinkDialog.buttonCancel_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at Telerik.Windows.Controls.RadButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

 

Can you please help with an explaination as to why these exceptions may be occuring?

We used the RTB to add the text and add the link.  The exception only occurs during an edit.  The work around for the moment seems to be to remove the hyperlink and then readd.

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 05 Jun 2012, 10:13 AM
Hi Michael,

This bug was introduced at a very late stage of development and passed into the final builds of the 2011 Q3 official release. Unfortunately, there is no convenient workaround of the problem.

The good new is that the issue has been resolved in the Q3 service pack (2011.3.1220) and does not appear in any versions after 2011 Q3. Therefore, if you upgrade to a newer version of the controls, everything should work as expected.

Kind regards,
Iva Toteva
the Telerik team

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

Tags
RichTextBox
Asked by
Michael MSTG
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or