I use the SyntaxEditor (v2024.4.1113.48, but also checked 2025.3.813.462) in WPF and want to show a completion list. As soon as I call
completionWindow.Show();
the completion window is shown for a very short amount of time in the upper left corner of the screen (not at the carret position). And after approx 200ms the exception occurs.
The function is
private void ShowCompletionWindow(RadSyntaxEditor codeEditor, string[] candidates)
{
try
{
var completionWindow = codeEditor.IntelliPrompts.CompletionListWindow;
if (completionWindow?.Presenter == null)
{
return;
}
var completionList = new CompletionInfoCollection();
foreach (var candidate in candidates)
{
completionList.Add(new CompletionInfo(candidate));
}
completionWindow.Presenter.CompletionListItems = completionList;
// Validate caret position once more before showing
if (codeEditor.CaretPosition.LineNumber >= 0 && codeEditor.CaretPosition.LineNumber < codeEditor.Document.CurrentSnapshot.LineCount)
{
completionWindow.Show();
}
}
catch (Exception innerEx)
{
_log.Error("Exception showing completion window", innerEx);
}
}
This function gets called from TextDocument.TextContentChanged event handler. This might be the reason. I want to type and want to show identifieres, that start with the string that the user started typing.
The exception
at Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.SetPosition(Point pointInScreen) at Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.SetPosition(Point pointInEditorPresenter, Point pointAboveTheCaret) at Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.SetPositionInView() at System.EventHandler.Invoke(Object sender, EventArgs e) at Telerik.Windows.Controls.SyntaxEditor.Layout.SyntaxEditorLayout.OnArrangeExecuted() at Telerik.Windows.Controls.SyntaxEditor.Layout.SyntaxEditorLayout.Arrange() at Telerik.Windows.Controls.SyntaxEditor.UI.SyntaxEditorPresenter.ArrangeOverride(Size arrangeBounds) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)