Comments
6 comments
-
Official commentHello Bogdan,
Thanks for the write up, sorry you are having a little trouble with your SQL Prompt installation. I want to get a better understanding of what is occurring in your environment whenever this error is reproducing for you. You mentioned that you are just editing a sql script when the above behavior occurs and you get an entry in the Windows Event Viewer, is SSMS fully crashing in this case? If you click on SQL Prompt > Help > Locate Log Files and attach those files here, I can review a bit further as to what may be going on behind the scenes.
Additionally, is this behavior/crash happening when you are working on particular script or does it reproduce regardless of what you are working on? Have you tested in other versions of SSMS besides version 19.3.4
Thanks for the clarification, lets see if we cant get this resolved for you.
-
Hi, I checked the log files and this is the exception I found:
18612 2026-03-20 17:27:55.646 -07:00 [Error] LogService caught unhandled exception in AppDomain: 'A generic error occurred in GDI+.'
[Outer exception] System.Runtime.InteropServices.ExternalException : A generic error occurred in GDI+.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
at RedGate.SqlPrompt.CommonUI.Forms.SchemaInformation.ObjectDefinitionBox.toolbar1_Paint(Object sender, PaintEventArgs e)
at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I wanted to view the structure of a table. I hovered above the table name, then I clicked on the link displayed in the tooltip and that's when it crashed.
> Additionally, is this behavior/crash happening when you are working on particular script or does it reproduce regardless of what you are working on?
Re: the crashes happen intermittently, and I did not observe any pattern other than the fact that I spent more time editing sql scripts in SSMS, scripts that are relatively complex, and going back and forth between sql scripts.
> Have you tested in other versions of SSMS besides version 19.3.4
No, I did not. I don't like the most recent versions of SSMS. At one point I tried SQL Prompt in a more recent version of SSMS and it didn't work, so I didn't bother at all with newer versions. The truth is SSMS is not my main sql editor and tool for querying data, I use datagrip to edit scripts most of the time, but I like the sql prompt support for editing and I use ssms from time to time.
Btw, I use Windows 2016 Server over RDP, and I wonder if the system resources are exhausted because I have a lot of opened apps at the same time and that might trigger crash. I don't know. All I can say is that it is not the first time it happened.
-
Hi Bogdan,
Thanks for letting us know those extra details. Based off that error message, I would tend to agree with you that this could potentially be caused by GDI+ resource exhaustion from the RDP session you are utilizing. There should be a way that we can test this to confirm on your end, if you open a Task Manager window and go to the Details tab you should be able to add a “GDI Objects” column and monitor ssms.exe over time to see if that number is growing prior to a crash. (there is also a GDIProcessHandleQuota registry value that tells you what the max quota is)
Give the above a shot and if you see the GDI Objects value climbing throughout the session, consider restarting SSMS and seeing if that reclaims those handles. Of course let me know if you dont see an increase in GDI Objects and we can try troubleshooting elsewhere.
-
Hi Christian,
Thank you for the suggestions. Currently the GDI Objects shows 935. it is the highest followed by Task Manager, interestingly enough, which has 904 in that column.
The value for GDIProcessHandleQuota is 10000 (decimal).
I will keep an eye on it.
-
ok, I did an experiment:
1. I opened ssms and I went connected to a database. GDI Objects = 222
2. I opened the open file dialog and closed it without opening a file. GDI Objects = 269
3. I opened a sql file with 1539 lines. GDI Objects = 409
4. Closed the file. GDI Objects = 359
It seems to me that SSMS doesn't release all the GDI objects upon closing the file.
-
Hi Bogdan,
Thanks for performing those tests for us, throughout the time you were monitoring the GDI Objects level, did you see a crash behavior at any point?
Add comment
Please sign in to leave a comment.
Here is the exception in the windows event log:
Application: Ssms.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.ExternalException
at System.Drawing.Graphics.CheckErrorStatus(Int32)
at System.Drawing.Graphics.DrawLine(System.Drawing.Pen, Int32, Int32, Int32, Int32)
at RedGate.SqlPrompt.CommonUI.Forms.SchemaInformation.ObjectDefinitionBox.toolbar1_Paint(System.Object, System.Windows.Forms.PaintEventArgs)
at System.Windows.Forms.Control.OnPaint(System.Windows.Forms.PaintEventArgs)
at System.Windows.Forms.Control.PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs, Int16)
at System.Windows.Forms.Control.WmPaint(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)
It is not the first time it happens. I have been coding for about 2 hrs.
Sql Prompt version: 11.3.8.22342
Ssms version:
SQL Server Management Studio 19.3.4.0
SQL Server Management Objects (SMO) 16.200.48053.0+08fe64c9e8eb5ff3c7ea5787f145e9ecb3d57df8
Microsoft T-SQL Parser 17.0.27.0+b6df00d03710e3fafcbe827aad08bdbe9d45d1ab
Microsoft Analysis Services Client Tools 16.0.20054.0
Microsoft Data Access Components (MDAC) 10.0.14393.8592
Microsoft MSXML 3.0 6.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 10.0.14393