I have an application which is exclusively operated with touchscreen events. In some cases the application does not respond to touchscreen events anymore. Every tap on the screen causes the following exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Input.StylusDevice.GetTabletToElementTransform(IInputElement relativeTo)
at System.Windows.Input.StylusDevice.UpdateState(RawStylusInputReport report)
at System.Windows.Input.StylusLogic.PreNotifyInput(Object sender, NotifyInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.StylusLogic.InputManagerProcessInput(Object oInput)
at System.Windows.Input.StylusLogic.PreProcessInput(Object sender, PreProcessInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
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.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)
We have also added some logging to check if the device is present (WMI PNPdevice events). The log shows us that the device seems to be unplugged and plugged before that happens. Its a bit strange because the user did not unplug the device. There is an "Device Removal" event followed by a "Device Arrival" Event about 5 seconds later. All other Windows applications do get events - but our application does not process events.
[UPDATE]
I found out that the user unplugged the device for some seconds because the touchscreen was not responding anymore. He also told us that the content one of our datagrind controls was shaking +/- 5px very fast before that happend. Is also not true that every click was not working, scrolling the datagrid worked fine, some buttons were responsive - others not.
Sumary: - Datagrid content starts shaking/flickering very fast - Touchscreen does not respond anymore - User unplugs the touchscreen device for a short time - I get that exception for almost every click. (some buttons are working, datagrid scrolling is working)
[/UPDATE]
Is it a driver issue? Is it a bug in WPF? Is there anything i could do in my application (except restarting it)?
Platform: .net x32 v4.0.30319, c#