question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception "Collection was modified" in System.Windows.Input.StylusWisp on remote desktop

See original GitHub issue

Hi there, got this exception today on a remote machine directly after connecting via windows remote desktop:

System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) 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.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 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)

We have a .NET Framework 4.8 WPF Program running in the background, the window was not visible at that moment. Running on Windows 11 Pro.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
GSonofNuncommented, May 30, 2023

I do have a minidump of the crash if it would be helpful.

1reaction
Lumoryelcommented, Apr 24, 2023

@singhashish-wpf I never saw this bug again. What I noticed meanwhile: On Windows 11, when you run a .NET Framework 4.8 targeted program, it actually runs Framework 4.8.1 code while on windows 10 it runs 4.8 code.

Actually I’m confused about where to look for 4.8 and 4.8.1 code?

(I had this problem here with a 4.8 framework application: https://github.com/dotnet/wpf/issues/6319)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collection was modified; enumeration operation may not ...
The error happens when (or after) a client unsubscribes. It appears that the next time the NotifySubscribers() method is called, the foreach() ...
Read more >
NET API browser
NET API browser – your one-stop shop for all .NET-based APIs from Microsoft. Start searching for any managed APIs by typing in the...
Read more >
Why the error Collection was modified enumeration ...
This error occurs when a looping process is being running on a collection (Ex: List) and the collection is modified (data added or...
Read more >
'collection was modified; enumeration operation may not ...
I try to develop an application that communicate with HID device I got System.InvalidOperationException: 'Collection was modified; ...
Read more >
Collection was modified; enumeration operation may...
Microsoft.Mashup.Evaluator.Interface.ErrorException: Collection was modified; enumeration operation may not execute. ---> System.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found