[Mono-bugs] [Bug 81142][Nor] New - progressBar crash when fast updating value

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Mar 14 13:24:56 EDT 2007


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 edouard.sabatier at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81142

--- shadow/81142	2007-03-14 12:24:56.000000000 -0500
+++ shadow/81142.tmp.30288	2007-03-14 12:24:56.000000000 -0500
@@ -0,0 +1,185 @@
+Bug#: 81142
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: edouard.sabatier at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: progressBar crash when fast updating value
+
+This is a bug whith a progressBar. When I want to update the value, it crash.
+This bug appears only when you update the value very often.
+It doesn't crash when you update it pourcent by pourcent.
+I tried to use delegate in my thread but it doesn't make it works to.
+
+
+Steps to reproduce the problem:
+1. create a progressBar
+2. assign a value very often
+3. progressBar crash
+
+Actual Results:
+Unhandled Exception: System.InvalidOperationException: List has changed.
+  at System.Collections.ArrayList+SimpleEnumerator.MoveNext () [0x00000]
+  at System.Windows.Forms.Hwnd.AddInvalidArea (Rectangle rect) [0x00000]
+  at System.Windows.Forms.Hwnd.AddInvalidArea (Int32 x, Int32 y, Int32
+width, Int32 height) [0x00000]
+  at System.Windows.Forms.XplatUIX11.AddExpose (System.Windows.Forms.Hwnd
+hwnd, Boolean client, Int32 x, Int32 y, Int32 width, Int32 height) [0x00000]
+  at System.Windows.Forms.XplatUIX11.Invalidate (IntPtr handle, Rectangle
+rc, Boolean clear) [0x00000]
+  at System.Windows.Forms.XplatUI.Invalidate (IntPtr handle, Rectangle rc,
+Boolean clear) [0x00000]
+  at System.Windows.Forms.Control.Invalidate (Rectangle rc, Boolean
+invalidateChildren) [0x00000]
+  at System.Windows.Forms.Control.Invalidate () [0x00000]
+  at System.Windows.Forms.Control.Refresh () [0x00000]
+  at System.Windows.Forms.ProgressBar.set_Value (Int32 value) [0x00000]
+  at (wrapper remoting-invoke-with-check)
+System.Windows.Forms.ProgressBar:set_Value (int)
+  at BugProgressBar.Form1.UpdateProgressBar () [0x00000]
+  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()
+
+
+Expected Results:
+It works on mono
+
+How often does this happen? 
+always when you update the value so fast
+
+Additional Information:
+
+here find my sample class : Form1.cs that makes crash the progressbar
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Threading;
+
+namespace BugProgressBar
+{
+	/// <summary>
+	/// Description résumée de Form1.
+	/// </summary>
+	public class Form1 : System.Windows.Forms.Form
+	{
+		public System.Windows.Forms.Button button1;
+		public System.Windows.Forms.ProgressBar progressBar1;
+		/// <summary>
+		/// Variable nécessaire au concepteur.
+		/// </summary>
+		private System.ComponentModel.Container components = null;
+
+		public Form1()
+		{
+			//
+			// Requis pour la prise en charge du Concepteur Windows Forms
+			//
+			InitializeComponent();
+
+			//
+			// TODO : ajoutez le code du constructeur après l'appel à
+InitializeComponent
+			//
+		}
+
+		/// <summary>
+		/// Nettoyage des ressources utilisées.
+		/// </summary>
+		protected override void Dispose( bool disposing )
+		{
+			if( disposing )
+			{
+				if (components != null) 
+				{
+					components.Dispose();
+				}
+			}
+			base.Dispose( disposing );
+		}
+
+		#region Code généré par le Concepteur Windows Form
+		/// <summary>
+		/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
+		/// le contenu de cette méthode avec l'éditeur de code.
+		/// </summary>
+		private void InitializeComponent()
+		{
+			this.button1 = new System.Windows.Forms.Button();
+			this.progressBar1 = new System.Windows.Forms.ProgressBar();
+			this.SuspendLayout();
+			// 
+			// button1
+			// 
+			this.button1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
+			this.button1.Location = new System.Drawing.Point(192, 88);
+			this.button1.Name = "button1";
+			this.button1.TabIndex = 0;
+			this.button1.Text = "Lunch";
+			this.button1.Click += new System.EventHandler(this.button1_Click);
+			// 
+			// progressBar1
+			// 
+			this.progressBar1.Anchor =
+((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom
+| System.Windows.Forms.AnchorStyles.Left) 
+				| System.Windows.Forms.AnchorStyles.Right)));
+			this.progressBar1.Location = new System.Drawing.Point(8, 32);
+			this.progressBar1.Name = "progressBar1";
+			this.progressBar1.Size = new System.Drawing.Size(448, 23);
+			this.progressBar1.TabIndex = 1;
+			// 
+			// Form1
+			// 
+			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+			this.ClientSize = new System.Drawing.Size(464, 125);
+			this.Controls.Add(this.progressBar1);
+			this.Controls.Add(this.button1);
+			this.Name = "Form1";
+			this.Text = "Form1";
+			this.ResumeLayout(false);
+
+		}
+		#endregion
+
+		/// <summary>
+		/// Point d'entrée principal de l'application.
+		/// </summary>
+		[STAThread]
+		static void Main() 
+		{
+			Application.Run(new Form1());
+		}
+
+		private void button1_Click(object sender, System.EventArgs e)
+		{
+			Thread myThread = new Thread(new ThreadStart(UpdateProgressBar));
+			myThread.Start();
+		}
+
+		public void UpdateProgressBar()
+		{
+			int valeur = 0;
+			progressBar1.Visible = true;
+			progressBar1.Value = 0;
+			for(int i=0; i<100000000; i++)
+			{
+				valeur = Convert.ToInt32(i/1000000);
+				progressBar1.Value = valeur;
+			}
+			progressBar1.Value = 0;
+		}
+	}
+}


More information about the mono-bugs mailing list