4

起動時にスプラッシュスクリーンとして表示される初期ウィンドウを持つ WPF アプリがあります。起動中はバックグラウンド スレッドがあり、スプラッシュスクリーンのボタンをクリックしてこのスレッドをキャンセルできます。マウスを使用し、ボタンをクリックしてキャンセルしている間、これはすべて正常に機能します。ただし、タッチスクリーンを使用してこのボタンをクリックすると、アプリがクラッシュすることがあり、スタック トレースは次のようになります。アプリは、Windows 7 64 ビットで実行される 64 ビット ターゲットです。

Severity:
Fatal


Stack Trace:
Exception 0
Message: Object reference not set to an instance of an object.

StackTrace:

at MS.Internal.PointUtil.TryClientToRoot(Point point, PresentationSource presentationSource, Boolean throwOnError, Boolean& success)
at System.Windows.Input.StylusDevice.GetPosition(IInputElement relativeTo)
at System.Windows.Input.StylusDevice.ChangeStylusOver(IInputElement stylusOver)
at System.Windows.Input.StylusLogic.PreProcessInput(Object sender, PreProcessInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.PossiblyDeactivate(IntPtr hwndCapture, Boolean stillActiveIfOverSelf)
at System.Windows.Interop.HwndMouseInputProvider.Dispose()
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

FromSubsystem:
PresentationCore
Help Link:
Not specified

以前にこの問題に遭遇した人はいますか?

4

2 に答える 2

2

Luz De Gan の回答に基づいて、RealTimeStylus を無効にすることなく、ウィンドウを閉じるのを遅らせることが最も効果的であることがわかりました。

キャンセル イベント ハンドラーで、これを使用してウィンドウのクローズを遅らせます。

Dispatcher.InvokeAsync(this.Close, DispatcherPriority.Input);

DispatcherPriority.Inputこれは、タッチ入力イベントが処理された後に確実に閉じるために必要です。

于 2015-08-10T16:55:00.673 に答える