Exception when reconnecting RDP session on Windows 2003 Server

Sep 4, 2011 at 7:14 AM


I use my Wizard also on Windows 2003 without all this nice Aero features. Everytime when I disconnect or minimize my RDP session and went back later the following exception is thrown:

t System.Drawing.Graphics.Clear(Color color)

   at AeroWizard.ThemedTableLayoutPanel.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


I digged into this and trying to use this workaround the prevent the exception window:

if (!this.IsDesignMode() && SupportGlass && DesktopWindowManager.IsCompositionEnabled())           
catch (Exception)               
{  }

Are you an idea how we can prevent this error?


Sep 4, 2011 at 8:20 AM



ok I worked  a little bit on this issue and found out this is the explaination:


Currently it's not allowed to paint in a DC on RDP sessions or secure desktop (e.g. UAC). I wrote a short wrapper arround the direct calls with exception  handling. This works for my TS use case very well. I will add this as patch :-)



Sep 8, 2011 at 6:05 PM

Corrected in the 1.1 release.