Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 4.7 - WPF - Touch Enabled Devices Crash Applications #480

Open
johnmurphy01 opened this issue Sep 14, 2017 · 11 comments

Comments

@johnmurphy01
Copy link

commented Sep 14, 2017

Our WPF application is experiencing a random crash when running on some touch enabled devices when running Windows 10 Creator Update. One example is the Lenovo IdeaPad 510. After about 5-10 minutes of operation, any interaction with the app(using a mouse, so not even using the touch capability) will cause the app to crash. The following stack trace is logged in the EventViewer:

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at MS.Win32.Penimc.UnsafeNativeMethods.GetPenEventMultiple(Int32, IntPtr[], IntPtr, Int32 ByRef, Int32 ByRef, Int32 ByRef, Int32 ByRef, Int32 ByRef, IntPtr ByRef)
at System.Windows.Input.PenThreadWorker.ThreadProc()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()

We discovered other WPF applications are experiencing this issue as well, including MS products such as Visual Studio and SQL Server Management Studio: https://developercommunity.visualstudio.com/content/problem/55303/visual-studio-may-terminate-unexpectedly-when-runn.html

There was a KB fix applied(bullet point 4): https://support.microsoft.com/en-in/help/4025342
However, our user experiencing the crash says they have this patch and the issue is persisting.

Is there a workaround to this? Is anyone at MS aware and working on this issue? Our customer is afraid to push our application to the public due to this issue that could be affecting numerous users with touch enabled devices. Any further insight into the problem could help our customer understand the impact of the problem

@Clemani

This comment has been minimized.

Copy link

commented Sep 19, 2017

I think the only workaround is to disable the tablet support. You loose touch scroll and maybe pen not working as good as before.
Some links from me and others with maybe not exactly same but very similar issues:
#448
https://stackoverflow.com/questions/45721368/wpf-net-app-crashes-combobox-and-menu-events-not-fired-on-tablets-with-windows
https://stackoverflow.com/questions/46049673/wpf-touch-application-partially-freezes-on-net-framework-4-7
https://connect.microsoft.com/VisualStudio/Feedback/Details/3139096
https://connect.microsoft.com/VisualStudio/Feedback/Details/3139101
https://connect.microsoft.com/VisualStudio/Feedback/Details/3139882

I can only encourage you to report the error to MS in the hope that they will fix it some time.

@johnmurphy01

This comment has been minimized.

Copy link
Author

commented Sep 19, 2017

I can confirm that disabling touch/stylus support does work.

The solution is to use the AppContext switching to disable the feature in OnStartup:

AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport", true);

This is a workaround and MS should ultimately fix the issue. I've upvoted all of the forum posts which mention this problem and everyone else should as well. I also have a MS contact that I've mentioned this to but he's not a programmer persay.

@Clemani

This comment has been minimized.

Copy link

commented Sep 20, 2017

Yes, they really should fix it. I reported the error here on 7/28, absolutely no response from MS.
Then at https://connect.microsoft.com/VisualStudio/Feedback on 8/8, at least one response "we are working..." on 8/21, i guess now just a standard be patient answer.
The error is so easy to re-produce, it's ridiculous.

@Mike-AgileBits

This comment has been minimized.

Copy link

commented Nov 2, 2017

We are now seeing that some of 1Password customers reporting the suggested workaround no longer works on Fall Creators Update.

Have anyone found a different workaround that may work on Fall Creators Update or with .NET 4.7.1?

@Clemani

This comment has been minimized.

Copy link

commented Nov 2, 2017

At least the "freeze" issues (not working dropdowns...) seems to be solved with .NET 4.7.1 on Anniversary and Creators April update...... but not in the Fall update!
The Fall update is even more horrible than the Spring Update.

@SERWare

This comment has been minimized.

Copy link

commented Nov 9, 2017

I have a legacy application targeting 3.5 and it navigates by means of ShowDialog() hiding parent and showing child and vice versa (it's very strange, but they programmed it like this and although we are changing it, it's still in production). The application hangs randomly in Windows 10 with touch devices when going from parent to child or vice versa. However, it worked by disabling the touch devices. But now I've found that on some new computers with the Creator Update it hangs even if touch is disabled.

But what worries me most of all is that I've build targeting 4.7 with the AppContextSwitchOverrides value="Switch.System.Windows.Input.Stylus.EnablePointerSupport=true" documented in https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/mitigation-pointer-based-touch-and-stylus-support and it's still happening. Of course, in the new version we don't use ShowDialog () in that way, but in some points it is very convenient to show a modal dialog and we are afraid to use it.

@richlander

This comment has been minimized.

Copy link
Member

commented Nov 13, 2017

Sorry for the delay on responding. I just sent mail to the team asking for help.

@SERWare

This comment has been minimized.

Copy link

commented Nov 13, 2017

This weekend I've done a lot of testing because I had to install the application on a new laptop that comes with the creators upgrade factory installed, but doesn't even have a touch screen.

The fact is that our application was hung up on dialogues, pop-ups, etc., even though the computer does not have any touch devices, stylus, etc. And the problem continued even going back to the anniversary update. So the solution has been to downgrade to Windows 8 (I have had a lot of downgrade problems with the Windows Product Key and some drivers but in the end I managed to fix it).

EDIT

I edit to tell you that once I've solved C++ library problem, and been able to use a special camera that uses our application, the problem has reappeared. It doesn't happen until I use the camera and it may be because I left the bridge to native C# libraries in 3.5, but until I check it, I can't say 4.7.1 fixes WPF problems.

BEFORE EDIT

Once I've been able to deliver the new laptop with the application running in Windows 8, I've given 4.7.1 a chance because they have fixed quite a lot of WPF bugs with new devices (memory leaks,etc), and it turns out that our application targeting 4.7.1 (with my previous message switch in config) doesn't hang up in any dialog, dropdown, etc (I have stack imbalance problems going up from 3.5 to 4.7.1 with some native C++ libraries but I think I can fix them).

@richlander

This comment has been minimized.

Copy link
Member

commented Nov 18, 2017

The team tells me that they are in the process of investigating part of what is reported on this thread. The other parts are fixed in the November 2017 Update.

@SERWare

This comment has been minimized.

Copy link

commented Nov 20, 2017

I have just downloaded and applied the november 2017 update for 1709 (4048955), and the version of our application targeting 4.7.1 is still hanging randomly.

However, the version targeting 4.7.1 takes longer to hang than the version that targets 3.5.

@NimbusHex

This comment has been minimized.

Copy link

commented Apr 5, 2018

Having an issue that seems related to this problem. Eventually my WPF application will stop responding to touch altogether, usually around 5-10 minutes after launching the application. Mouse/Keyboard input still work fine, so the application is clearly still responsive. The only resolve for this is disabling stylus support, but you lose touch scrolling, which is a pretty big deal. My app is targeting 4.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.