WindowTop/WindowTop-App

Fatal error "Overflow or underflow in the arithmetic operation" from "System.Windows.Media.Imaging"

gileli121 opened this issue · 3 comments

Created from comment: #344 (comment)

Hello, i have a laptop, with external monitor, i cannot use WindowTop anymore on my laptop, yet on another pc, at my workplace, that's too dual monitor set-up (is pc not laptop) i can use WindowTop without issues.

every time when i boot up the laptop the error pops up, or, if i terminate the .exe from taskmanager, then starting the .exe again, error pops up again.

Screenshot attached, also text attached with the error.
Annotation 2024-03-01 061945

**Version: v5.22.6
Type: MS Store
Installed: Yes
IsAdminHelper: No
IsAdmin: No

**Logs from last hour:
5ZH8X: [Info] Loading the app manager
5ZH8X: [Info] Loading the UwpAppManager
1HYXF: [Info] Installing dlls in UWP LocalFolder of the current user
1HYXF: [Info] Coping the ShrinkInteractHook.dll to C:\Users\anton\AppData\Local\Packages\25571BiGilSoft.WindowTop_gejtaqnb6x66e\LocalState\dlls\ShrinkInteractHook.dll
1HYXF: [Info] Adding dll folder as C:\Users\anton\AppData\Local\Packages\25571BiGilSoft.WindowTop_gejtaqnb6x66e\LocalState\dlls
5ZH8X: [Info] Loading cached data
5ZH8X: [Info] Loading the activation manager
5ZH8X: [Info] Loading the UwpActivationManager
5ZH8X: [Info] Load settings
5ZH8X: [Info] Setting the defined language
5ZH8X: [Info] SetLanguage called
5ZH8X: [Info] SetLanguage is falling back to default language
5ZH8X: [Info] SetLanguage is configuring language en
5ZH8X: [Info] Loading activation state
1WTDI: [Info] Code 7AZLH
ETJ8F: [Info] Code P1QS2
ETJ8F: [Info] Code WBCBJ
ETJ8F: [Info] Code CNWFN. Data: 02/21/2024 04:38:12
ETJ8F: [Info] Code AGD2O. Data: 9
ETJ8F: [Info] Code ENL4R. Data: 9
ETJ8F: [Info] Code PX4QK. Data: True
ETJ8F: [Info] Code BKT94. Data: True,False
1WTDI: [Info] Code PVF4X. Data: True,False
1WTDI: [Info] Code 58LFF
1WTDI: [Info] Code VZ63E
1WTDI: [Info] Code P7743. Data: True,True,False,False
5ZH8X: [Info] Load MonitorHwnd Manager subsystem
MYYJ4: [Info] Adding monitor 65539
FGA1F: [Info] Loading monitor 65539
FGA1F: [Info] Monitor loaded: [Handle: 65539 X: 3840, Y: 0, W: 1920, H: 1080, rcMonitor: 5760,0,8640,1620]
MYYJ4: [Info] Adding monitor 65537
FGA1F: [Info] Loading monitor 65537
FGA1F: [Info] Monitor loaded: [Handle: 65537 X: 0, Y: 0, W: 3840, H: 2160, rcMonitor: 0,0,3840,2160]
5ZH8X: [Info] Load Window Manager subsystem
3BXOQ: [Info] Init()
5ZH8X: [Error] Got fatal exception and handled by App_OnDispatcherUnhandledException: System.OverflowException: The image data generated an overflow during processing. ---> System.ArithmeticException: Overflow or underflow in the arithmetic operation.
--- End of inner exception stack trace ---
at System.Windows.Media.Imaging.ColorConvertedBitmap.FinalizeCreation()
at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation()
at System.Windows.Media.Imaging.BitmapSource.CompleteDelayedCreation()
at System.Windows.Media.Imaging.BitmapSource.get_WicSourceHandle()
at System.Windows.Media.Imaging.BitmapSource.get_DUCECompatiblePtr()
at System.Windows.Media.Imaging.BitmapSource.UpdateBitmapSourceResource(Channel channel, Boolean skipOnChannelCheck)
at System.Windows.Media.Imaging.BitmapSource.AddRefOnChannelCore(Channel channel)
at System.Windows.Media.Imaging.BitmapSource.System.Windows.Media.Composition.DUCE.IResource.AddRefOnChannel(Channel channel)
at System.Windows.Media.ImageBrush.AddRefOnChannelCore(Channel channel)
at System.Windows.Media.Brush.System.Windows.Media.Composition.DUCE.IResource.AddRefOnChannel(Channel channel)
at System.Windows.Media.Visual.UpdateOpacityMask(Channel channel, ResourceHandle handle, VisualProxyFlags flags, Boolean isOnChannel)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.Render(RenderContext ctx, UInt32 childIndex)
at System.Windows.Media.CompositionTarget.Compile(Channel channel)
at System.Windows.Media.CompositionTarget.System.Windows.Media.ICompositionTarget.Render(Boolean inResize, Channel channel)
at System.Windows.Media.MediaContext.Render(ICompositionTarget resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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)
5ZH8X: [Info] SetLanguage called
5ZH8X: [Info] SetLanguage is falling back to default language
5ZH8X: [Info] SetLanguage is configuring language en

**Exception:
System.OverflowException: The image data generated an overflow during processing. ---> System.ArithmeticException: Overflow or underflow in the arithmetic operation.
--- End of inner exception stack trace ---
at System.Windows.Media.Imaging.ColorConvertedBitmap.FinalizeCreation()
at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation()
at System.Windows.Media.Imaging.BitmapSource.CompleteDelayedCreation()
at System.Windows.Media.Imaging.BitmapSource.get_WicSourceHandle()
at System.Windows.Media.Imaging.BitmapSource.get_DUCECompatiblePtr()
at System.Windows.Media.Imaging.BitmapSource.UpdateBitmapSourceResource(Channel channel, Boolean skipOnChannelCheck)
at System.Windows.Media.Imaging.BitmapSource.AddRefOnChannelCore(Channel channel)
at System.Windows.Media.Imaging.BitmapSource.System.Windows.Media.Composition.DUCE.IResource.AddRefOnChannel(Channel channel)
at System.Windows.Media.ImageBrush.AddRefOnChannelCore(Channel channel)
at System.Windows.Media.Brush.System.Windows.Media.Composition.DUCE.IResource.AddRefOnChannel(Channel channel)
at System.Windows.Media.Visual.UpdateOpacityMask(Channel channel, ResourceHandle handle, VisualProxyFlags flags, Boolean isOnChannel)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle)
at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
at System.Windows.Media.Visual.Render(RenderContext ctx, UInt32 childIndex)
at System.Windows.Media.CompositionTarget.Compile(Channel channel)
at System.Windows.Media.CompositionTarget.System.Windows.Media.ICompositionTarget.Render(Boolean inResize, Channel channel)
at System.Windows.Media.MediaContext.Render(ICompositionTarget resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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)

Originally posted by @Don-Compadre in #344 (comment)

Don-Compadre,
According to the search, this seems to be related to https://github.com/dotnet/wpf (external dependency from Microsoft) and not a crash from WindowTop code directly.

Here is another issue about it that is reported here:

dotnet/wpf#3884
https://stackoverflow.com/questions/63510630/wpf-bitmapimage-exception-the-image-data-generated-an-overflow-during-processin

I could not reproduce it myself yet. But according to what I read, this also has something to do with Windows 10.
Do you use Windows 10?

First, please try to update your system.
It is possible that after updating Windows, the issue should be fixed (according to what I read)

If this does not fix the problem, continue to read -

I saw that it reported that it happened after the user changed color configuration using the "color management" app or after a system update in Windows 10.

Did you make some changes using the color management app?

Anyway, to confirm that it has something to do with this, please search for the "color management" app, go to the "Advanced" tab, and send me a screenshot of it.

I saw that it was reported that changing all options to "System default" or changing the "Device profile" to "sRGB IEC61966-2.1"

Please try both options (default and "sRGB IEC61966-2.1") and restart after each attempt.

If it solves the issue, we know that your case is about the same bug that was reported (in WPF)

Gileli121, I thank you so much for your help! Sincerely! I respect your meaningful work! I want to let you know that it really helps me in studying for exams and for myself. The functions and features of your software allow and unlock the capability to pull multiple pieces of information from various sources (programs/browsers) because they can be very organized on the limited size of the screen and the unlimited virtual desktops of the PC (at least on Windows), therefore enabling the extraction of data in an 'uncluttered' and easy-to-use manner.

You've nailed it! Keep going after it with your projects! I hope that you will continue to keep grinding on your trained abilities! And I hope that those trained abilities of yours will collide with an opportunity, sooner or later, at least, one opportunity will arise, make sure to be ready for it!!! Don't stop when you're tired, stop when you're done!!!

image

Thank you very much for this response!
I am glad to help and provide value for people!
Enjoy!

I am closing it since it is probably the best possible solution and rare anyway.