[Mono-bugs] [Bug 76326][Nor] Changed - Sometimes Windows Forms get
a Null Reference Exception
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Oct 5 15:04:25 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by carlos at applianz.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76326
--- shadow/76326 2005-10-04 22:10:06.000000000 -0400
+++ shadow/76326.tmp.4260 2005-10-05 15:04:25.000000000 -0400
@@ -79,6 +79,142 @@
Sorry can't give you the code that reproduces it, work related, and
strangely enough it only happens on one of my many .net apps I am
trying out under mono, I will keep trying to write some code I can
submit to reproduce the problem.
If its any help I am pretty sure it always worked on 1.1.8 although I
did much less testing before 1.1.9 was already out.
+
+------- Additional Comments From carlos at applianz.com 2005-10-05 15:04 -------
+I have some simple code that reproduces the problem most of the time
+on Gentoo 64bit, the code was compiled on Windows 32bit. I think it
+has to do with the using of the Listbox from a separate thread maybe
+even before the Form is ran by Application.Run
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+
+namespace Test
+{
+ /// <summary>
+ /// Summary description for Form1.
+ /// </summary>
+ public class Form1 : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.ListBox listBox1;
+ private System.Windows.Forms.Button button1;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public Form1()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.listBox1 = new System.Windows.Forms.ListBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(40, 40);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(88, 20);
+ this.textBox1.TabIndex = 0;
+ this.textBox1.Text = "textBox1";
+ //
+ // listBox1
+ //
+ this.listBox1.Location = new System.Drawing.Point(32, 88);
+ this.listBox1.Name = "listBox1";
+ this.listBox1.Size = new System.Drawing.Size(88, 95);
+ this.listBox1.TabIndex = 1;
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(184, 176);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(88, 64);
+ this.button1.TabIndex = 2;
+ this.button1.Text = "button1";
+ //
+ // Form1
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(292, 273);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.listBox1);
+ this.Controls.Add(this.textBox1);
+ this.Name = "Form1";
+ this.Text = "Form1";
+ this.Load += new System.EventHandler(this.Form1_Load);
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Form1 f = new Form1();
+ System.Threading.Thread thread = new System.Threading.Thread(new
+System.Threading.ThreadStart(f.Start));
+ thread.IsBackground = true;
+ thread.Start();
+ Application.Run(f);
+ }
+
+ private void Form1_Load(object sender, System.EventArgs e)
+ {
+
+ }
+ private void Start()
+ {
+ while(true)
+ {
+ this.listBox1.Items.Add("test");
+ System.Threading.Thread.Sleep(100);
+
+ }
+ }
+ }
+}
+
More information about the mono-bugs
mailing list