I am developing editor with RichTextBox under .Net 3.5 WPF environment VS2013 Ultimate Update 4 and VS2015 Community Update 3.
I need to check screen position of current caret position and scroll automatically scroller when I type any text.
code is here.
private void Italicbtn_Click(object sender, RoutedEventArgs e)
{
editorctrl.SetFontProperties(richtextbox1, TextElement.FontStyleProperty, FontStyles.Italic);
richtextbox1.Focus();
}
private void Richtextbox1_PreviewKeyDown(object sender, KeyEventArgs e)
{
Rect r = GetCurrentCaretPos();
// scroller down
//if (rect.Y > 400)
//{
// scroller1.LineDown();
//}
}
public Rect GetCurrentCaretPos()
{
Rect rect = richtextbox1.CaretPosition.GetCharacterRect(LogicalDirection.Backward);
Debug.WriteLine(String.Format("CaretPos : {0} {1}", rect.X, rect.Y));
return rect;
}
typing language is non-english, Hangul korea.
If I type without Italic style, it's fine even if I type slow with Italic style.
But If I type a little fast with Italic style, Sample Application just shutdowns on VS2015.
My real Project with same Logic has System.ExecutionEngineException on VS2013.
Below is error stacks.
How can I fix it?
> WindowsBase.dll!MS.Internal.Invariant.FailFast(string message, string detailMessage) 알 수 없음
WindowsBase.dll!MS.Internal.Invariant.Assert(bool condition, string invariantMessage) 알 수 없음
PresentationFramework.dll!System.Windows.Documents.CaretElement.OnRenderCaretSubElement(System.Windows.Media.DrawingContext context) 알 수 없음
PresentationFramework.dll!System.Windows.Documents.CaretElement.CaretSubElement.OnRender(System.Windows.Media.DrawingContext drawingContext) 알 수 없음
PresentationCore.dll!System.Windows.UIElement.Arrange(System.Windows.Rect finalRect) 알 수 없음
PresentationFramework.dll!System.Windows.Documents.CaretElement.ArrangeOverride(System.Windows.Size availableSize) 알 수 없음
PresentationFramework.dll!System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect finalRect) 알 수 없음
PresentationCore.dll!System.Windows.UIElement.Arrange(System.Windows.Rect finalRect) 알 수 없음
PresentationFramework.dll!System.Windows.Documents.AdornerLayer.ArrangeOverride(System.Windows.Size finalSize) 알 수 없음
PresentationFramework.dll!System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect finalRect) 알 수 없음
PresentationCore.dll!System.Windows.UIElement.Arrange(System.Windows.Rect finalRect) 알 수 없음
PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayout() 알 수 없음
PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayoutCallback(object arg) 알 수 없음
PresentationCore.dll!System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork() 알 수 없음
PresentationCore.dll!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() 알 수 없음
PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget) 알 수 없음
PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget) 알 수 없음
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, bool isSingleParameter) 알 수 없음
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) 알 수 없음
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() 알 수 없음
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) 알 수 없음
mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) 알 수 없음
[native에서 managed로 전환]
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) 알 수 없음
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) 알 수 없음
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) 알 수 없음
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) 알 수 없음
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) 알 수 없음
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, bool isSingleParameter) 알 수 없음
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) 알 수 없음
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) 알 수 없음
[native에서 managed로 전환]
[managed에서 native로 전환]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) 알 수 없음
WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() 알 수 없음
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) 알 수 없음
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) 알 수 없음
PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) 알 수 없음
PresentationFramework.dll!System.Windows.Application.Run() 알 수 없음