Jump to content

Out Of Range Exception in Paint .NET 4.0.16 under Win 10

Recommended Posts



the app crashes immediately whenever the mouse hovers over the taskbar icon.


Assuming Paint .Net is using an unchanged version of Microsoft's TabbedThumbnailNativeMethods.cs, it looks like the DwmSetIconicThumbnail function is called with an invalid thumbnail bitmap. This exception occurs if the taskbar thumbnail violates the maximum boundaries or has an invalid color depth.


"An application typically calls the DwmSetIconicThumbnail function after it receives a WM_DWMSENDICONICTHUMBNAIL message for its window. The thumbnail should not exceed the maximum x-coordinate and y-coordinate that are specified in that message. The thumbnail must also have a 32-bit color depth."



In this context, it could also be an issue with high DPI, since I encountered several problems with native functions (e.g. getting the correct mouse position on the desktop) in windows forms applications, if the application does not call the SetProcessDPIAware function at startup. The "dpiaware" tag in the manifest file does not cover all scenarios.


Exception details:

System.ArgumentException: Der Wert liegt außerhalb des erwarteten Bereichs.

   bei Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailNativeMethods.SetIconicThumbnail(IntPtr hwnd, IntPtr hBitmap) in D:\src\pdn\src\SystemLayer\WindowsAPICodePack\Shell\Interop\Taskbar\TabbedThumbnailNativeMethods.cs:Zeile 114.

   bei Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.DispatchSendIconThumbnailMessage(Message& m, TaskbarWindow taskbarWindow) in D:\src\pdn\src\SystemLayer\WindowsAPICodePack\Shell\Taskbar\TaskbarWindowManager.cs:Zeile 265.

   bei Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.DispatchMessage(Message& m, TaskbarWindow taskbarWindow) in D:\src\pdn\src\SystemLayer\WindowsAPICodePack\Shell\Taskbar\TaskbarWindowManager.cs:Zeile 714.

   bei Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailProxyWindow.WndProc(Message& m) in D:\src\pdn\src\SystemLayer\WindowsAPICodePack\Shell\Taskbar\TabbedThumbnailProxyWindow.cs:Zeile 39.

   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


Hopefully I could help you a little bit :-)


Kind regards,



Link to comment
Share on other sites

Yeah I've gotten a few reports of this. Not sure what causes it. Last week, for the upcoming 4.0.17 update, I put in some code that suppresses the exception. So you might see a visual glitch, but at least it won't crash for something menial like this.

  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...