Please could someone help to solve this? Is there any patch for it or known
workaround?
Here's the problem description:
I have a winforms application written in C#. When I'm in a terminal services
session, running the application, occasionally I get
Message: A generic error occurred in GDI+.
Stack Trace: at System.Drawing.Graphics.Clear(Color color) at
Intercerve.Windows.Forms.CalendarRuler.OnPaintBackground(PaintEventArgs
pevent) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs
e, Int16 layer, Boolean disposeEventArgs) at
System.Windows.Forms.Control.WmPaint(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at
System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at
System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)
I've seen this error be raised from other controls as well, and even in
other applications that I know are written on top of the .NET framework, so I
know it's not specific to my application. Its happened on my machine, which
is Windows 2003 SP1, as well as other people's machines, running multiple
different operating systems.
The only common thread is that it seems to happen when in a Terminal
Services session. It also seems to happen if I leave my computer and come
back to the application, and we've had people report it when the application
is minimized then restored within a TS session.
Does anyone have any insight on this issue?
--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
"eXavier" <eXa...@community.nospam> wrote in message
news:EB754243-B59D-4BF8...@microsoft.com:
Based on my understanding, you have a WinForm application on a Windows
Server 2003 machine. When you connect to the Windows Server 2003 machine
from another machine using Remote Desktop Connection and run this
application, the application occasionaly crashes with GDI+ error. If I'm
off base, please feel free to let me know.
To make things clear, I'd like to ask several questions about this issue.
1. If you run the application directly from the Windows Server 2003
machine, does the application crash with GDI+ error?
2. What operation do you perform on the application before the GDI+ error
occurs?
3. Does this problem exist on all machines that connect to the Windows
Server 2003 machine using Remote Desktop Connection?
It's hard to diagnose what the problem is only depending on the general
exception stack information. If possible, could you send me a sample
project that could just reproduce the problem? To get my actual email
address, remove 'online' from my displayed email address.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
1) The application runs well if not running through Remote Desktop (RD).
2) No specific operation - application is active and running without
interaction. Typical scenario is that user switch out of RD window (or
minimalize RD). After switching back in undetermined time(approx 15min) to
RD, the application throws GDI+ exception in Graphics.Clear() at
OnPaintBackground(). Referred control is inherited from
System.Windows.Forms.TabControl and OnPaintBackground method is not overrided.
3) We have observed this problem on all machines with the same symptoms.
Further we have found the same problem reported by someone else in another
newsgroup.
This problem is hard to replicate as we cannot see any specific condition
when this happens - not every swithing window causes the problem. Sometimes
it runs for few hours without crashing, sometimes it crashes in few minutes.
Thanks for your help
eXavier
Thank you for your prompt reply.
I have searched in our inner database and found a similar issue in it. The
reason why GDI+ error occurs is that GDI+ fail to render to the disconnect
desktop, e.g. secure desktop on a CTRL_ALT_DEL or minimize the terminal
client window.
The behaviour of GDI+ is by design and we could ignore the exception
occurring in this case. To do this, override the
TabControl.OnPaintBackground method and catch the exception in the override
method and then ingore it.
Hope this helps.
If you have anything unclear, please feel free to let me know.
If GDI+ throws the exception by design, isn't then bug in TabControl itself?
I'm just guessing that it should be catched inside
TabControl.OnPaintBackground()..
Sincerely
eXavier
Thank you for your prompt response.
According to the document I found in our inner database, it should not be a
bug in either GDI+ or TabControl. How can TabControl know that it is being
used in a terminal session? So, we have to catch the exception by
ourselves.
Thank you for using our MSDN Managed Newsgroup Support Service. If you have
any other questions in the future, please don't hesitate to contact us.
It's always our pleasure to be of assistance!