dotnet / dotnet/wpf

Logitech mouse scrolling causes exception

Open
#7,882 11 comments 1 reaction 0 assignees View on GitHub
Untriaged
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

Hi, we've had multiple customers using a Logitech mouse report crashes lately with this stack:

```
OverflowException: Arithmetic operation resulted in an overflow.
at System.Windows.Shell.WindowChromeWorker._HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Shell.WindowChromeWorker._WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
```

It sounds like it is a Logitech driver bug that isn't well handled by .NET.
https://stackoverflow.com/questions/50282355/why-does-my-wpf-application-crash-when-i-bump-my-mousewheel
https://developercommunity.visualstudio.com/t/overflow-exception-in-windowchrome/167357

“WPF applications which are built for x64 and use the WindowChrome class throw an OverflowException when receiving a horizontal scroll command from a Logitech mouse configured with SetPoint.”
“It seems like a bad assumption is made in Standard.Utility that lParams always fit in 32 bits, and some mouse drivers violate that on 64-bit systems by writing there.”

The developer community issue was closed long ago, but we recently updated to .NET 6 and started getting customer reports (although we have not been able to determine how to repro it locally). The developer community post has a suggested workaround, but it's a fairly ugly workaround to add so we'd like to see about getting a fix in .NET.

Thanks!

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.