dotnet / dotnet/wpf

clr20r3: CLR_EXCEPTION_80131623_PresentationFramework.dll!System.Windows.Controls.TextBoxView.GetLineIndexFromOffset

Open
#842 0 comments 2 reactions 0 assignees View on GitHub
Bug
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

Copied from VSO ID: 845615

Source Watson

**Call Stack**
The call stack provided below is only a SAMPLE. Please use the cab search link above to obtain latest cabs and call stacks.

1. WindowsBase.ni!MS.Internal.Invariant.FailFast in Invariant.cs
2. at PresentationFramework.ni!System.Windows.Controls.TextBoxView.GetLineIndexFromOffset in TextBoxView.cs
3. at PresentationFramework.ni!System.Windows.Controls.TextBoxView.HandleTextSelectionHighlightChange in TextBoxView.cs
4. at PresentationFramework.ni!System.Windows.Controls.TextBoxView.OnHighlightChanged in TextBoxView.cs
5. at PresentationFramework.ni!System.Windows.Documents.Highlights.OnLayerChanged in Highlights.cs
6. at PresentationFramework.ni!System.Windows.Documents.TextSelectionHighlightLayer.InternalOnSelectionChanged in TextSelectionHighlightLayer.cs
7. at PresentationFramework.ni!System.Windows.Documents.TextSelectionHighlightLayer.OnSelectionChanged in TextSelectionHighlightLayer.cs
8. at PresentationFramework.ni!System.Windows.Documents.TextRange.System.Windows.Documents.ITextRange.FireChanged in TextRange.cs
9. at PresentationFramework.ni!System.Windows.Documents.TextSelection.System.Windows.Documents.ITextRange.NotifyChanged in TextSelection.cs
10. at PresentationFramework.ni!System.Windows.Documents.TextRangeBase.EndChange in TextRangeBase.cs
11. at PresentationFramework.ni!System.Windows.Documents.TextRange.System.Windows.Documents.ITextRange.EndChange in TextRange.cs
12. at PresentationFramework.ni!System.Windows.Documents.TextEditor.Undo in TextEditor.cs
13. at PresentationFramework.ni!System.Windows.Documents.TextEditor.OnUndo in TextEditor.cs
14. at PresentationCore.ni!System.Windows.Input.CommandBinding.OnExecuted in CommandBinding.cs
15. at PresentationCore.ni!System.Windows.Input.CommandManager.ExecuteCommandBinding in CommandManager.cs
16. at PresentationCore.ni!System.Windows.Input.CommandManager.FindCommandBinding in CommandManager.cs
17. at PresentationCore.ni!System.Windows.Input.CommandManager.OnExecuted in CommandManager.cs
18. at PresentationCore.ni!System.Windows.UIElement.OnExecutedThunk in UIElement.cs
19. at PresentationCore.ni!System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler in ExecutedRoutedEventArgs.cs
20. at PresentationCore.ni!System.Windows.RoutedEventArgs.InvokeHandler in RoutedEventArgs.cs
21. at PresentationCore.ni!System.Windows.RoutedEventHandlerInfo.InvokeHandler in RoutedEventHandlerInfo.cs
22. at PresentationCore.ni!System.Windows.EventRoute.InvokeHandlersImpl in EventRoute.cs
23. at PresentationCore.ni!System.Windows.UIElement.RaiseEventImpl in UIElement.cs
24. at PresentationCore.ni!System.Windows.UIElement.RaiseTrustedEvent in UIElement.cs
25. at PresentationCore.ni!System.Windows.UIElement.RaiseEvent in UIElement.cs
26. at PresentationCore.ni!System.Windows.Input.RoutedCommand.ExecuteImpl in RoutedCommand.cs
27. at PresentationCore.ni!System.Windows.Input.RoutedCommand.ExecuteCore in RoutedCommand.cs
28. at PresentationCore.ni!System.Windows.Input.CommandManager.TranslateInput in CommandManager.cs
29. at PresentationCore.ni!System.Windows.UIElement.OnKeyDownThunk in UIElement.cs
30. at PresentationCore.ni!System.Windows.Input.KeyEventArgs.InvokeEventHandler in KeyEventArgs.cs
31. at PresentationCore.ni!System.Windows.RoutedEventArgs.InvokeHandler in RoutedEventArgs.cs
32. at PresentationCore.ni!System.Windows.RoutedEventHandlerInfo.InvokeHandler in RoutedEventHandlerInfo.cs
33. at PresentationCore.ni!System.Windows.EventRoute.InvokeHandlersImpl in EventRoute.cs
34. at PresentationCore.ni!System.Windows.UIElement.RaiseEventImpl in UIElement.cs
35. at PresentationCore.ni!System.Windows.UIElement.RaiseTrustedEvent in UIElement.cs
36. at PresentationCore.ni!System.Windows.UIElement.RaiseEvent in UIElement.cs
37. at PresentationCore.ni!System.Windows.Input.InputManager.ProcessStagingArea in InputManager.cs
38. at PresentationCore.ni!System.Windows.Input.InputManager.ProcessInput in InputManager.cs
39. at PresentationCore.ni!System.Windows.Input.InputProviderSite.ReportInput in InputProviderSite.cs
40. at PresentationCore.ni!System.Windows.Interop.HwndKeyboardInputProvider.ReportInput in HwndKeyboardInputProvider.cs
41. at PresentationCore.ni!System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction in HwndKeyboardInputProvider.cs
42. at PresentationCore.ni!System.Windows.Interop.HwndSource.CriticalTranslateAccelerator in HwndSource.cs
43. at PresentationCore.ni!System.Windows.Interop.HwndSource.OnPreprocessMessage in HwndSource.cs
44. at WindowsBase.ni!System.Windows.Threading.ExceptionWrapper.InternalRealCall in ExceptionWrapper.cs
45. at WindowsBase.ni!System.Windows.Threading.ExceptionWrapper.TryCatchWhen in ExceptionWrapper.cs
46. at WindowsBase.ni!System.Windows.Threading.Dispatcher.LegacyInvokeImpl in Dispatcher.cs
47. at WindowsBase.ni!System.Windows.Threading.Dispatcher.Invoke in Dispatcher.cs
48. at PresentationCore.ni!System.Windows.Interop.HwndSource.OnPreprocessMessageThunk in HwndSource.cs
49. at PresentationCore.ni!System.Windows.Interop.HwndSource in HwndSource.cs
50. at WindowsBase.ni!System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage in ComponentDispatcherThread.cs
51. at Microsoft.VisualStudio.Platform.WindowManagement.ni!Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.PreTranslateInput in WindowManagerService.cs
52. at Microsoft.VisualStudio.Platform.WindowManagement.ni!DomainNeutralILStubClass.IL_STUB_COMtoCLR

**Initial research:**
From basic code inspection it looks like WPF gets into a state where there is a highlight for text selection that specifies an offset that is outside of the line metrics. Perhaps something is being done on an event handler that modifies the text or the text selection and that is causing the mismatch. In any case, we can guard against this relatively simply.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.