Wpf: Throw IndexOutOfRangeException in WispLogic.CoalesceAndQueueStylusEvent

Created on 13 Jun 2019  路  7Comments  路  Source: dotnet/wpf

  • .NET Core Version: 3.0.100-preview5-011568
  • Windows version: 1903 18362.145
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Find in 4.7

Problem description:

The application crash.

We find many customs will break the application when he touch the application. I catch the AppDomain.CurrentDomain.UnhandledException and find the WispLogic.CoalesceAndQueueStylusEvent may be break the application.

See: https://stackoverflow.com/questions/46049673/wpf-touch-application-partially-freezes-on-net-framework-4-7

And Bruno V tell me that it fix in .NET 4.7.1, but it seems not fix in dotnet core.

I can not debug it, because 200 users found the crash among 300,000 users.

  • .NET 4.7: 200 users found the crash among 300,000 users.
  • .NET Core 3.0: 2 users found the crash among 600 users.

    Actual behavior:

exceptions

ExceptionType: System.IndexOutOfRangeException

callstack for crashes

   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Windows.Input.StylusWisp.WispLogic.CoalesceAndQueueStylusEvent(RawStylusInputReport inputReport)
   at System.Windows.Input.StylusWisp.WispLogic.ProcessInputReport(RawStylusInputReport inputReport)
   at System.Windows.Input.PenContext.FirePackets(Int32 stylusPointerId, Int32[] data, Int32 timestamp)
   at System.Windows.Input.PenThreadWorker.FlushCache(Boolean goingOutOfRange)
   at System.Windows.Input.PenThreadWorker.FireEvent(PenContext penContext, Int32 evt, Int32 stylusPointerId, Int32 cPackets, Int32 cbPacket, IntPtr pPackets)
   at System.Windows.Input.PenThreadWorker.ThreadProc()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Expected behavior:

The application can run.

Minimal repro:

An empty WPF application and run in touch device.

issue-type-bug

Most helpful comment

Why it break in .NET Framework 4.7 for Windows10 Creators Update?

My friend @kkwpsv download the source code from https://referencesource.microsoft.com and find the .NET 4.7 for Windows 10 Creators Update have not add lock to WispLogic.CoalesceAndQueueStylusEvent and the other add the lock.

So it only break in .NET Framework 4.7 for Windows10 Creators Update. And .NET Framework 4.7 RTM add the lock to WispLogic.CoalesceAndQueueStylusEvent and fix it.

Which version add lock?

Which version remove lock?

The funny thing is .NET 4.7 RTM add the lock to WispLogic.CoalesceAndQueueStylusEvent and the .NET 4.7.1 Downlevel remove it.

The .NET 4.7.2 for Windows 10 April 2018 Creators Update is the frist version to add lock and it seems fix in .NET 4.7.2 not fix in .NET 4.7.1

See https://stackoverflow.com/a/56575786/6116637

c# - WPF applications stop responding to touches after adding or removing tablet devices - Stack Overflow

All 7 comments

My friend @kkwpsv find the code in .NET 4.7 for Windows 10 Creators Update have not add lock in WispLogic.CoalesceAndQueueStylusEvent. So it seems that it only can find in .NET 4.7 for Windows 10 Creators Update and it fix in dotnet core.

Why it break in .NET Framework 4.7 for Windows10 Creators Update?

My friend @kkwpsv download the source code from https://referencesource.microsoft.com and find the .NET 4.7 for Windows 10 Creators Update have not add lock to WispLogic.CoalesceAndQueueStylusEvent and the other add the lock.

So it only break in .NET Framework 4.7 for Windows10 Creators Update. And .NET Framework 4.7 RTM add the lock to WispLogic.CoalesceAndQueueStylusEvent and fix it.

Which version add lock?

Which version remove lock?

The funny thing is .NET 4.7 RTM add the lock to WispLogic.CoalesceAndQueueStylusEvent and the .NET 4.7.1 Downlevel remove it.

The .NET 4.7.2 for Windows 10 April 2018 Creators Update is the frist version to add lock and it seems fix in .NET 4.7.2 not fix in .NET 4.7.1

See https://stackoverflow.com/a/56575786/6116637

c# - WPF applications stop responding to touches after adding or removing tablet devices - Stack Overflow

Last time I checked not all downloads at referencesource were correctly labeled. Be careful how you associate them with the actual .NET version, they may actually be another version than the zip file name says.

@weltkante Could you tell me which it is incorrectly? I want to fix it.

@lindexi If you downloaded within the last month then DotNet472RS4.zip is actually the same as 4.7 RTM and does not contain 4.7.2 source code. I think that was the only mistake left after I've sent them feedback. If you downloaded before last month then there were more files mixed up, I don't have a complete list, but at least dotnet462RTM.zip, DotNet47RS2.zip and DotNet47RTM.zip downloads were all wrong at some point in the past, but have been corrected since. (Also I do not know what the 'ZDP' release is, so I cannot tell if its wrong or not.)

@lindexi If you downloaded within the last month then DotNet472RS4.zip is actually the same as 4.7 RTM and does not contain 4.7.2 source code. I think that was the only mistake left. If you downloaded before then there were more files mixed up. (I do not know what the 'ZDP' release is, so I cannot tell if its wrong or not.)

I download them from "https://referencesource.microsoft.com/" today. I follow the version that it says.

Just checked, DotNet472RS4.zip still contains 4.7 RTM and not 4.7.2

Was this page helpful?
0 / 5 - 0 ratings