All pastes #52304 Raw Edit

Unnamed

public text v1 · immutable
#52304 ·published 2006-04-29 23:56 UTC
rendered paste body
Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: brush
in [0x00036] System.Drawing.Graphics:FillRectangle (System.Drawing.Brush brush, Rectangle rect)
in (wrapper remoting-invoke-with-check) System.Drawing.Graphics:FillRectangle (System.Drawing.Brush,System.Drawing.Rectangle)

Here is the problem, the following line of code is accessing some brushes that are created during the
OnLoad method call, but OnLoad has not been called yet at this point.  This is calling basically
FillRectangle with a null brush (uninitialized).

in [0x000d6] (at /home/cvs/pdn/src/TextConfigWidget.cs:545) PaintDotNet.TextConfigWidget:fontComboBox_DrawItem (System.Object sender, System.Windows.Forms.DrawItemEventArgs e)

in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_DrawItemEventArgs (object,System.Windows.Forms.DrawItemEventArgs)
in [0x0002b] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs:743) System.Windows.Forms.ComboBox:OnDrawItem (System.Windows.Forms.DrawItemEventArgs e)
in [0x00064] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs:1017) System.Windows.Forms.ComboBox:Draw (Rectangle clip, System.Drawing.Graphics dc)
in [0x00019] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs:1174) System.Windows.Forms.ComboBox:OnPaintInternal (System.Windows.Forms.PaintEventArgs pevent)
in [0x001f0] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3769) System.Windows.Forms.Control:WndProc (System.Windows.Forms.Message m)
in [0x00002] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs:925) System.Windows.Forms.ComboBox:WndProc (System.Windows.Forms.Message m)
in [0x00007] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:160) System.Windows.Forms.Control+ControlNativeWindow:WndProc (System.Windows.Forms.Message m)
in [0x00056] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:146) System.Windows.Forms.NativeWindow:WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam)
in [0x00005] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:3862) System.Windows.Forms.XplatUIX11:SendMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam)
in [0x0002c] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:4405) System.Windows.Forms.XplatUIX11:UpdateWindow (IntPtr handle)
in [0x00006] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:891) System.Windows.Forms.XplatUI:UpdateWindow (IntPtr handle)
in [0x0001c] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:2960) System.Windows.Forms.Control:Refresh ()in [0x0005e] (at /home/cvs/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs:479) System.Windows.Forms.ComboBox:set_SelectedItem (System.Object value)
in (wrapper remoting-invoke-with-check) System.Windows.Forms.ComboBox:set_SelectedItem (object)

Here is the constructor, it is preparing the ComboBox, by doing:

comboBox.SelectedItem = "SomeValue";

This in turns triggers the whole "Repaint" chain of events above.

in [0x000fc] (at /home/cvs/pdn/src/TextConfigWidget.cs:78) PaintDotNet.TextConfigWidget:.ctor ()
in (wrapper remoting-invoke-with-check) PaintDotNet.TextConfigWidget:.ctor ()
in [0x00017] (at /home/cvs/pdn/src/DocumentWorkspace.cs:1016) PaintDotNet.DocumentWorkspace:InitializeComponent ()
in [0x0004b] (at /home/cvs/pdn/src/DocumentWorkspace.cs:608) PaintDotNet.DocumentWorkspace:.ctor ()
in (wrapper remoting-invoke-with-check) PaintDotNet.DocumentWorkspace:.ctor ()
in [0x0046e] (at /home/cvs/pdn/src/MainForm.cs:780) PaintDotNet.MainForm:InitializeComponent ()
in [0x0017a] (at /home/cvs/pdn/src/MainForm.cs:256) PaintDotNet.MainForm:.ctor (System.String[] args)
in (wrapper remoting-invoke-with-check) PaintDotNet.MainForm:.ctor (string[])
in [0x00006] (at /home/cvs/pdn/src/Startup.cs:91) PaintDotNet.Startup:Start ()
in [0x00006] (at /home/cvs/pdn/src/Startup.cs:149) PaintDotNet.Startup:Main (System.String[] args)
make: *** [run] Error 1