dotnet / dotnet/wpf

WPF Crash on modern Touchscreen when EnablePointerSupport is enabled

Open
#8,435 21 comments 2 reactions 0 assignees View on GitHub
:construction: work in progress Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

On a Surface Pro 9 my WPF app crashes when clicking anything.

This seems to be caused by enabling Switch.System.Windows.Input.Stylus.EnablePointerSupport

I have attached an example repo

![image](https://github.com/dotnet/wpf/assets/20043350/56275e3a-b16c-4260-9430-07f11e801b0b)

This was recommend by CefSharp in there Example
See here:
https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Wpf.Example/App.xaml.cs

```
> PresentationCore.dll!System.Windows.Input.StylusPointPropertyInfo.StylusPointPropertyInfo(System.Windows.Input.StylusPointProperty stylusPointProperty, int minimum, int maximum, System.Windows.Input.StylusPointPropertyUnit unit, float resolution) Zeile 70 C#
PresentationCore.dll!System.Windows.Input.StylusPointer.PointerStylusPointPropertyInfoHelper.CreatePropertyInfo(MS.Win32.Pointer.UnsafeNativeMethods.POINTER_DEVICE_PROPERTY prop) Zeile 47 C#
PresentationCore.dll!System.Windows.Input.StylusPointer.PointerTabletDeviceInfo.TryInitializeSupportedStylusPointProperties() Zeile 97 C#
PresentationCore.dll!System.Windows.Input.StylusPointer.PointerTabletDeviceInfo.TryInitialize() Zeile 38 C#
PresentationCore.dll!System.Windows.Input.StylusPointer.PointerTabletDeviceCollection.Refresh() Zeile 56 C#
PresentationCore.dll!System.Windows.Input.StylusPointer.PointerLogic.TabletDevices.get() Zeile 74 C#
PresentationCore.dll!System.Windows.Input.StylusPointer.PointerLogic.PostProcessInput(object sender, System.Windows.Input.ProcessInputEventArgs e) Zeile 205 C#
PresentationCore.dll!System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(System.Tuple postProcessInput, System.Windows.Input.ProcessInputEventArgs processInputEventArgs) Zeile 614 C#
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() Zeile 586 C#
PresentationCore.dll!System.Windows.Input.MouseDevice.ChangeMouseCapture(System.Windows.IInputElement mouseCapture, System.Windows.Input.IMouseInputProvider providerCapture, System.Windows.Input.CaptureMode captureMode, int timestamp) C#
PresentationCore.dll!System.Windows.Input.MouseDevice.Capture(System.Windows.IInputElement element, System.Windows.Input.CaptureMode captureMode) C#
PresentationFramework.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e) Unbekannt
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Zeile 201 C#
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Zeile 124 C#
PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args, System.Windows.RoutedEvent newEvent) Zeile 6273 C#
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Zeile 201 C#
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Zeile 124 C#
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) Zeile 6298 C#
PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) Zeile 2710 C#
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() Zeile 546 C#
PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) Zeile 52 C#
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(nint hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) Zeile 797 C#
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(nint hwnd, MS.Internal.Interop.WindowMessage msg, nint wParam, nint lParam, ref bool handled) Zeile 343 C#
PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(nint hwnd, int msg, nint wParam, nint lParam, ref bool handled) Zeile 1140 C#
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(nint hwnd, int msg, nint wParam, nint lParam, ref bool handled) Unbekannt
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unbekannt
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unbekannt
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unbekannt
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(nint hwnd, int msg, nint wParam, nint lParam) Unbekannt
[Übergang von Nativ zu Verwaltet]
[Übergang von Verwaltet zu Nativ]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unbekannt
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Unbekannt
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unbekannt
PointerErrorWpfApp.dll!PointerErrorWpfApp.App.Main() Unbekannt
```

### Reproduction Steps

https://github.com/dos-ise/SurfaceStylusError/tree/master

### Expected behavior

Should not crash

### Actual behavior

Crashes immediately

### Regression?

Can also be reproduced in net4.8

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

_No response_

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.