[Mono-bugs] [Bug 363897] New: DataGridView complains that font argument connot be null

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 21 22:53:28 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=363897


           Summary: DataGridView complains that font argument connot be null
           Product: Mono Tasks
           Version: ongoing
          Platform: x86
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: shane at actionengine.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


I have an extremely basic winform app that uses a DataGridView control.  I
simply created the project using the Visual Studio 2005 wizard for a winform
app, dragged over a DataGridView object, gave it a single column, and added
three lines of code to populate one row.  All the code is attached.

It runs fine on Windows as expected.  Running on Ubuntu Desktop 7.10, which
ships with mono 1.2.4, I got an exception.  I upgraded to the latest stable
1.2.6 via the package at www.backports.org/debian and got the same exception.

First, here is the code, which the wizard generated except for the Form1_Load
implementation (my 3 lines):

namespace GridBug
{
        public partial class Form1 : Form
        {
                public Form1()
                {
                        InitializeComponent();
                }

                private void Form1_Load(object sender, EventArgs e)
                {
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(dataGridView1, "testing 1");
                        dataGridView1.Rows.Add(row);
                }
        }
}

namespace GridBug
{
        partial class Form1
        {
                private System.ComponentModel.IContainer components = null;

                protected override void Dispose(bool disposing)
                {
                        if (disposing && (components != null)) {
                                components.Dispose();
                        }
                        base.Dispose(disposing);
                }

                #region Windows Form Designer generated code

                private void InitializeComponent()
                {
                        this.dataGridView1 = new
System.Windows.Forms.DataGridView();
                        this.Body = new
System.Windows.Forms.DataGridViewTextBoxColumn();
                        ((System.ComponentModel.ISupportInitialize)
(this.dataGridView1)).BeginInit();
                        this.SuspendLayout();
                        // 
                        // dataGridView1
                        // 
                        this.dataGridView1.ColumnHeadersHeightSizeMode =
System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                        this.dataGridView1.Columns.AddRange(new
System.Windows.Forms.DataGridViewColumn[] {
            this.Body});
                        this.dataGridView1.Location = new
System.Drawing.Point(28, 53);
                        this.dataGridView1.Name = "dataGridView1";
                        this.dataGridView1.Size = new System.Drawing.Size(240,
150);
                        this.dataGridView1.TabIndex = 0;
                        // 
                        // Body
                        // 
                        this.Body.HeaderText = "The Body";
                        this.Body.Name = "Body";
                        // 
                        // Form1
                        // 
                        this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
                        this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
                        this.ClientSize = new System.Drawing.Size(292, 266);
                        this.Controls.Add(this.dataGridView1);
                        this.Name = "Form1";
                        this.Text = "Form1";
                        this.Load += new System.EventHandler(this.Form1_Load);
                        ((System.ComponentModel.ISupportInitialize)
(this.dataGridView1)).EndInit();
                        this.ResumeLayout(false);

                }

                #endregion

                private System.Windows.Forms.DataGridView dataGridView1;
                private System.Windows.Forms.DataGridViewTextBoxColumn Body;
        }
}

When I run this in Windows it is fine.  On Ubuntu I get:

shane at shane2u:~/Desktop$ mono GridBug.exe 
System.ArgumentNullException: Argument cannot be null.
Parameter name: font
  at System.Drawing.Graphics.DrawString (System.String s, System.Drawing.Font
font, System.Drawing.Brush brush, RectangleF layoutRectangle,
System.Drawing.StringFormat format) [0x00000] 
  at (wrapper remoting-invoke-with-check) System.Drawing.Graphics:DrawString
(string,System.Drawing.Font,System.Drawing.Brush,System.Drawing.RectangleF,System.Drawing.StringFormat)
  at System.Windows.Forms.DataGridViewTextBoxCell.Paint
(System.Drawing.Graphics graphics, Rectangle clipBounds, Rectangle cellBounds,
Int32 rowIndex, DataGridViewElementStates cellState, System.Object value,
System.Object formattedValue, System.String errorText,
System.Windows.Forms.DataGridViewCellStyle cellStyle,
System.Windows.Forms.DataGridViewAdvancedBorderStyle advancedBorderStyle,
DataGridViewPaintParts paintParts) [0x00000] 
  at System.Windows.Forms.DataGridViewCell.InternalPaint
(System.Drawing.Graphics graphics, Rectangle clipBounds, Rectangle cellBounds,
Int32 rowIndex, DataGridViewElementStates cellState, System.Object value,
System.Object formattedValue, System.String errorText,
System.Windows.Forms.DataGridViewCellStyle cellStyle,
System.Windows.Forms.DataGridViewAdvancedBorderStyle advancedBorderStyle,
DataGridViewPaintParts paintParts) [0x00000] 
  at System.Windows.Forms.DataGridView.OnPaint
(System.Windows.Forms.PaintEventArgs e) [0x00000] 
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m)
[0x00000] 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
[0x00000] 
  at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message&
m) [0x00000] 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x00000] 

shane at shane2u:~/Desktop$ mono --version
Mono JIT compiler version 1.2.6 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list