You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
Problem description:
Sometimes, I met a problem that wpf touch function does not work. I have no idea what's wrong with my computer.
I make a screen recording about this bug . Actual behavior:
I summarize some tests:
All of the wpf touch function is abnormal even if I restart wpf application. (Button click with touch, inkcanvas touch...).
Disable HID-compliant touch screen, then enable it, still does not work.
Change touch device(monitor) and restart application still does not work.
Change another account(B user) and don't sign out (A current user) Windows, B user's wpf touch is normal,
and switch to (A user) that wpf touch still don't work.
We doubt there are something wrong with Wisp, because I use other app that is not wpf app, it use wisp and also have the similar question.
If I use "EnablePointerSupport", touch will be normal. But there are some reason I cannot use "EnablePointerSupport". I write a easy sample code to reproduce as attach video. Expected behavior:
Touch can work well. Minimal repro:
When this error occurs, it can always be reproduced as long as Windows is not restarted.
@HouZack The bad news is maybe it is a known issue. See #2054
Could you add new WindowInteropHelper(this).EnsureHandle(); before you show the window to test? Thank you @lindexi Because I have rebooted computer and need to wait for next time the problem occurs.
@lindexi Hi. I had the same issue with touch. After i use following code almost at all devices touch start to work like it's should but I have a new Surface Pro 9 and if i enable this feature on it. Application start to crash with following exception System.ArgumentException: '{0}' must be greater than or equal to '{1}'. (Parameter 'maximum')
Could it be that this feature 'Switch.System.Windows.Input.Stylus.EnablePointerSupport= true' not exists at new devices?
@lindexi Actualy that is all what i receive. Also i find out that MoudleDoubleClick command stop work with touch after i run 'AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);'
@lindexi In my case touch stop working well after any dialog is closed. After this Main windows stop react on touch event at least for first 10. Event if I subscribe to TouchDown event its not raise for first 10-15 click
After ''AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);''
Events start to raise like it's should but MouseDoubleClick not works and one device throw exception
@lindexiSystem.ArgumentException: '{0}' must be greater than or equal to '{1}'. (Parameter 'maximum') at System.Windows.Input.StylusPointPropertyInfo..ctor(StylusPointProperty stylusPointProperty, Int32 minimum, Int32 maximum, StylusPointPropertyUnit unit, Single resolution)
This error i get from your application. The same what i receive in my after i enable ''AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);''
@lindexi
I already using the fix suggestion that you mentioned in this post
public App()
{
AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);
}
But our co-work company using a new touch panel in ongoing project and using our product for verification but found our software won't react to click/touch/stylus moving. The error message as following and in attachments. I am wondering if you could do help to check them and give some clues to fix this problem.
10-30-2023 00:56:23 [Exception in LogUnhandledException] exception: System.ArgumentException: '{0}' must be greater than or equal to '{1}'. (Parameter 'maximum')
at System.Windows.Input.StylusPointPropertyInfo..ctor(StylusPointProperty stylusPointProperty, Int32 minimum, Int32 maximum, StylusPointPropertyUnit unit, Single resolution)
at System.Windows.Input.StylusPointer.PointerStylusPointPropertyInfoHelper.CreatePropertyInfo(POINTER_DEVICE_PROPERTY prop)
at System.Windows.Input.StylusPointer.PointerTabletDeviceInfo.TryInitializeSupportedStylusPointProperties()
at System.Windows.Input.StylusPointer.PointerTabletDeviceInfo.TryInitialize()
at System.Windows.Input.StylusPointer.PointerTabletDeviceCollection.Refresh()
@wangtenghong The exception as follow says the touch data do not match the HID Descriptors define.
10-30-2023 00:56:23 [Exception in LogUnhandledException] exception: System.ArgumentException: '{0}' must be greater than or equal to '{1}'. (Parameter 'maximum')
at System.Windows.Input.StylusPointPropertyInfo..ctor(StylusPointProperty stylusPointProperty, Int32 minimum, Int32 maximum, StylusPointPropertyUnit unit, Single resolution)
Common issues often involve defining the width and height of touch points in the HID descriptor, but the actual reported touch point data only includes X and Y coordinates, without the width and height information. You can use the BusHound tool to capture packets to understand the touch point data reported by your touch device, and check if there are any definition errors. Additionally, it's also possible that the points you output exceed the maximum and minimum value range defined by your descriptor.
And from the code of the constructor in StylusPointPropertyInfo, it is evident that there is an error in your data. Your maximum value is less than your minimum value.
Activity
lindexi commentedon Sep 21, 2022
@HouZack What is your DPI ? Could you change the system DPI to 100%
HouZack commentedon Sep 21, 2022
My DPI is always 100%.
lindexi commentedon Sep 21, 2022
@HouZack Do you have two touch screen?
HouZack commentedon Sep 21, 2022
Yes, even if I use the second touch screen, the touch still doesn't work. Some of the tests I summarized in the third point above.
lindexi commentedon Sep 22, 2022
@HouZack The bad news is maybe it is a known issue. See #2054
Could you add
new WindowInteropHelper(this).EnsureHandle();before you show the window to test? Thank youHouZack commentedon Sep 24, 2022
HouZack commentedon Oct 21, 2022
@lindexi I add

new WindowInteropHelper(this).EnsureHandle();but touch still not work. Thanks.lindexi commentedon Oct 21, 2022
@HouZack Is your Application TopMost ?
See https://developercommunity.visualstudio.com/content/problem/255063/on-windows-10-1803-all-applications-lost-touch-or.html
13 remaining items
kircsa08 commentedon Jan 28, 2023
thank you so much, the 2nd workaround has solved my issue !!
RVPryimak commentedon Sep 21, 2023
@lindexi Hi. I had the same issue with touch. After i use following code almost at all devices touch start to work like it's should but I have a new Surface Pro 9 and if i enable this feature on it. Application start to crash with following exception
System.ArgumentException: '{0}' must be greater than or equal to '{1}'. (Parameter 'maximum')Could it be that this feature 'Switch.System.Windows.Input.Stylus.EnablePointerSupport= true' not exists at new devices?
lindexi commentedon Sep 21, 2023
@RVPryimak Could you add more exception info?
RVPryimak commentedon Sep 21, 2023
@lindexi Actualy that is all what i receive. Also i find out that MoudleDoubleClick command stop work with touch after i run 'AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);'
RVPryimak commentedon Sep 21, 2023
@lindexi In my case touch stop working well after any dialog is closed. After this Main windows stop react on touch event at least for first 10. Event if I subscribe to TouchDown event its not raise for first 10-15 click
After ''AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);''
Events start to raise like it's should but MouseDoubleClick not works and one device throw exception
lindexi commentedon Sep 21, 2023
@RVPryimak Your problems are beyond imagination. And can you try my demo: https://github.com/dotnet-campus/ManipulationDemo
RVPryimak commentedon Sep 21, 2023
@lindexi
System.ArgumentException: '{0}' must be greater than or equal to '{1}'. (Parameter 'maximum') at System.Windows.Input.StylusPointPropertyInfo..ctor(StylusPointProperty stylusPointProperty, Int32 minimum, Int32 maximum, StylusPointPropertyUnit unit, Single resolution)This error i get from your application. The same what i receive in my after i enable ''AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);''
lindexi commentedon Sep 21, 2023
@RVPryimak I'm guessing the problem from your touch screen or the system
And It appears that the HID descriptor is incorrect
RVPryimak commentedon Sep 21, 2023
@lindexi I will try to provide small example with my issue. I will be appreciate if you will have time to look on it
wangtenghong commentedon Nov 13, 2023
@lindexi
I already using the fix suggestion that you mentioned in this post
But our co-work company using a new touch panel in ongoing project and using our product for verification but found our software won't react to click/touch/stylus moving. The error message as following and in attachments. I am wondering if you could do help to check them and give some clues to fix this problem.
part-of-log.txt
lindexi commentedon Nov 13, 2023
@wangtenghong The exception as follow says the touch data do not match the HID Descriptors define.
Common issues often involve defining the width and height of touch points in the HID descriptor, but the actual reported touch point data only includes X and Y coordinates, without the width and height information. You can use the BusHound tool to capture packets to understand the touch point data reported by your touch device, and check if there are any definition errors. Additionally, it's also possible that the points you output exceed the maximum and minimum value range defined by your descriptor.
lindexi commentedon Nov 13, 2023
And from the code of the constructor in StylusPointPropertyInfo, it is evident that there is an error in your data. Your maximum value is less than your minimum value.
wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointPropertyInfo.cs
Lines 64 to 67 in c8a6d45
Fix StylusPointPropertyInfo crash from invalid HID min/max values