WPF crash by virtual keyboard

-1

I develop WPF kiosk app. We created a virtual keyboard.

Problem

When i type the korean keyboard, app is crash randomly.

i find solution.

but i dont want this solution. because we use Tablet PC Input Service for CS part member.

i want to know why this problem occurs, and I want to know other solutions.

I think it's a compatibility issue between sendkey and WPF.

Example Source

WPF
<TextBox x:Name="TB_Input1" />
C#
TB_Input1.Forcus();
System.Windows.Forms.SendKeys.SendWait("k");

event log

Faulting application name: Application.exe, version: 2.3.13.271, time stamp: 0xa4726363
Faulting module name: PresentationFramework.ni.dll, version: 4.6.1586.0, time stamp: 0x575a1951
Exception code: 0x80131623
Fault offset: 0x0000000001109170
Faulting process id: 0xbdc
Faulting application start time: 0x01d5f1b7e917ff0c
Faulting application path: C:\Application.exe
Faulting module path: C:\Windows\assembly\NativeImages_v4.0.30319_64\Presentatio5ae0f00f#\a3317d3137e1e1302c5f8f34ffce1622\PresentationFramework.ni.dll
Report Id: da4ebd8f-d0ac-49bb-97af-8156847188da
Faulting package full name: 
Faulting package-relative application ID: 
Framework 버전: v4.0.30319
설명: 응용 프로그램이System.Environment.FailFast(문자열 메시지)를 통해 프로세스 종료를 요청했습니다.
메시지: 복구할 수 없는 시스템 오류입니다.
스택:
   위치: System.Environment.FailFast(System.String)
   위치: System.Windows.Documents.TextStore.SetFinalDocumentState(MS.Internal.Documents.UndoManager, System.Collections.Stack, Int32, Int32, Int32, Int32, Int32)
   위치: System.Windows.Documents.TextStore.HandleCompositionEvents(Int32)
   위치: System.Windows.Documents.TextStore.GrantLockWorker(LockFlags)
   위치: System.Windows.Documents.TextStore.RequestLock(LockFlags, Int32 ByRef)
   위치: System.Windows.Forms.UnsafeNativeMethods.GetMessageW(MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32)
   위치: System.Windows.Forms.UnsafeNativeMethods.GetMessageW(MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32)
   위치: System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
   위치: System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
   위치: System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
   위치: System.Windows.Forms.SendKeys.Flush()
   위치: System.Windows.Forms.SendKeys.Send(System.String, System.Windows.Forms.Control, Boolean)
   위치: Application.Services.Keyboard.KeyboardInputMethodEditor.InputCharKey(System.String)
   위치: Application.Services.Keyboard.KeyboardInputMethodEditor.Click(YoungIntClientV1.Services.Keyboard.BasicSkinKeyCaps, System.Func`1<Boolean>, System.Action)
   위치: System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   위치: System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   위치: System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   위치: System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   위치: System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
   위치: System.Windows.Input.InputManager.ProcessStagingArea()
   위치: System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   위치: System.Windows.Input.StylusLogic.PromoteMainToMouse(System.Windows.Input.StagingAreaInputItem)
   위치: System.Windows.Input.StylusLogic.PromoteMainUpToTouch(System.Windows.Input.StylusDevice, System.Windows.Input.StagingAreaInputItem)
   위치: System.Windows.Input.StylusLogic.PromoteMainToTouch(System.Windows.Input.ProcessInputEventArgs, System.Windows.Input.StylusEventArgs)
   위치: System.Windows.Input.StylusLogic.PostProcessInput(System.Object, System.Windows.Input.ProcessInputEventArgs)
   위치: System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(System.Windows.Input.ProcessInputEventHandler, System.Windows.Input.ProcessInputEventArgs)
   위치: System.Windows.Input.InputManager.ProcessStagingArea()
   위치: System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   위치: System.Windows.Input.StylusLogic.InputManagerProcessInput(System.Object)
   위치: System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   위치: System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   위치: System.Windows.Threading.DispatcherOperation.InvokeImpl()
   위치: MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
   위치: System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   위치: System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   위치: System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   위치: MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   위치: System.Windows.Threading.DispatcherOperation.Invoke()
   위치: System.Windows.Threading.Dispatcher.ProcessQueue()
   위치: System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   위치: MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   위치: MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   위치: System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   위치: System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   위치: System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   위치: MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   위치: MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   위치: MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   위치: System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   위치: System.Windows.Application.RunDispatcher(System.Object)
   위치: System.Windows.Application.RunInternal(System.Windows.Window)
   위치: Application.App.Main()
.net
wpf
windows
winapi
keyboard
asked on Stack Overflow Mar 4, 2020 by huinalam • edited Mar 5, 2020 by huinalam

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0