dotnet / dotnet/wpf

WispLogic - Collection was modified

Open
#11,123 2 comments 0 reactions 0 assignees View on GitHub
:beetle: bug Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

Hi team, we have several crashes in our telemetry (UiPath Studio) related to WispLogic - Collection was modified; enumeration operation may not execute, and wanted to check if this is know / if you have seen this before. Googling for "WispLogic" + "Collection was modified" only returns a bug report on our forum.

Over the past 7 days we've seen this exception 790 times across our user base.

There's a couple of different stack traces associated, but in the same area:

```
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at System.Windows.Input.StylusWisp.WispLogic.RefreshTablets()
at System.Windows.Input.StylusWisp.WispLogic.OnTabletRemovedImpl(UInt32 wisptisIndex, Boolean isInternalCall)
at System.Windows.Input.StylusWisp.WispLogic.HandleMessage(WindowMessage msg, IntPtr wParam, IntPtr lParam)
at System.Windows.SystemResources.InvalidateTabletDevices(WindowMessage msg, IntPtr wParam, IntPtr lParam)
at System.Windows.SystemResources.SystemThemeFilterMessage(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 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233079
```

```
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at System.Windows.Input.StylusWisp.WispLogic.OnTabletAdded(UInt32 wisptisIndex)
at System.Windows.Input.StylusWisp.WispLogic.HandleMessage(WindowMessage msg, IntPtr wParam, IntPtr lParam)
at System.Windows.SystemResources.SystemThemeFilterMessage(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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233079
```

### Reproduction Steps

Cannot reproduce at the moment. These stack traces are from our app telemetry.

### Expected behavior

Does not throw exception.

### Actual behavior

Throws exception.

### Regression?

No, it reproduces in application versions from 4 years ago.

### Known Workarounds

None.

### Impact

We've had 790 exception occurrences over the past 7 days across the user base.

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.