Skip to content

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

Closed

Description

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

Activity

  1. johnmurphy01 commented on Sep 19, 2017

    @johnmurphy01
    Author

    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.

  2. Clemani commented on Sep 20, 2017

    @Clemani

    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.

  3. Mike-AgileBits commented on Nov 2, 2017

    @Mike-AgileBits

    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?

  4. Clemani commented on Nov 2, 2017

    @Clemani

    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.

  5. SERWare commented on Nov 9, 2017

    @SERWare

    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.

  6. richlander commented on Nov 13, 2017

    @richlander
    Member

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

  7. SERWare commented on Nov 13, 2017

    @SERWare

    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).

  8. richlander commented on Nov 18, 2017

    @richlander
    Member

    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.

  9. SERWare commented on Nov 20, 2017

    @SERWare

    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.

  10. NimbusHex commented on Apr 5, 2018

    @NimbusHex

    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

  11. leecow commented on Jan 5, 2021

    @leecow
    Member

    This repo is no longer actively monitored. Closing up old issues that have not had activity in while. If this is still an issue, please open a new issue in an appropriate repo listed in microsoft/dotnet#1275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions