[Mono-winforms-list] TextBox error
Peter Dennis Bartok
peter at novonyx.com
Wed Mar 29 20:35:01 EST 2006
You should check what the size of the control is. Up your stack is
UpdateBounds, it's causing the size changed event, and that event causes
recalculation of scrollbar and document. The viewport and scrollbar numbers
are just a result out of the new size of the control. I have just tested,
even with a size of 1x1 it doesn't crash (even though it will tell the
document code that the viewport is negative). The problem of the original
poster (on the nabble thing you referenced) looks like was that he was
running old code, which had a bug with exactly those symptoms, and that has
since been fixed.
Instead of posting a stacktrace of some code you modified, you should post
the trace of the original crash you're getting.
Cheers,
Peter
-----Original Message-----
From: "lmatter" <cm-nabble at matter.net>
To: <mono-winforms-list at lists.ximian.com>
Date: 29 March, 2006 17:48
Subject: Re: [Mono-winforms-list] TextBox error
>
>(sorry about the previous post in html format)
>
>I'm a newcomer to C#; I'm a Java developer by day. I recently tried to
>port
>a colleague's VS C# app over to Mono, and basically ran into this issue as
>well.
>
>I have checked out the latest code (as of yesterday) from svn, built it
>using these instructions , and this code sample below gives the same
>error
>as the poster describes.
>
>I put in some checks into the WinForms code; throwing when illegal values
>are encountered and dumping the call trace. I'm still working my way up,
>but my unfamiliarity with this code is slowing me down. I thought I would
>post my current findings to see if someone else knows what's going on.
>
>The minimum and maximum vars in ScrollBar.cs are getting set to an invalid
>value (thus the orignal exception about 0 begin invalid), and it stems from
>the TextBoxBase document instance.
>
>I added a check in TextControl.cs, Document class, viewport_height property
>set method to check for a negative number and throw (this top exception is
>my code):
>
>Unhandled Exception: System.Exception: viewport_height Value '-2147483645'
>must
>be greater than or equal to 0.
>in [0x00025] System.Windows.Forms.Document:set_ViewPortHeight (Int32 value)
>in [0x00045] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/TextBoxBase.cs:1404)
>System.Windows.Forms.TextBoxBase:TextBoxBase_Size
>hanged (System.Object sender, System.EventArgs e)
>in (wrapper delegate-invoke)
>System.MulticastDelegate:invoke_void_object_EventA
>gs (object,System.EventArgs)
>in [0x00020] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/Control.cs:4368) System.Windows.Forms.Control:OnSizeChanged
>(System.Ev
>ntArgs e)
>in [0x000bb] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/Control.cs:3665) System.Windows.Forms.Control:UpdateBounds (Int32
>x, I
>t32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
>in [0x00057] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/Control.cs:3633) System.Windows.Forms.Control:UpdateBounds (Int32
>x, I
>t32 y, Int32 width, Int32 height)
>in [0x00069] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/Control.cs:3518) System.Windows.Forms.Control:SetBoundsCore (Int32
>x,
>nt32 y, Int32 width, Int32 height, BoundsSpecified specified)
>in [0x00041] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/TextBoxBase.cs:1105)
>System.Windows.Forms.TextBoxBase:SetBoundsCore
>(I
>t32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
>in [0x00008] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/Control.cs:3061) System.Windows.Forms.Control:SetBounds (Int32 x,
>Int3
> y, Int32 width, Int32 height)
>in (wrapper remoting-invoke-with-check)
>System.Windows.Forms.Control:SetBounds
>int,int,int,int)
>in [0x00376] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/Control.cs:2867) System.Windows.Forms.Control:PerformLayout
>(System.Wi
>dows.Forms.Control affectedControl, System.String affectedProperty)
>in (wrapper remoting-invoke-with-check)
>System.Windows.Forms.Control:PerformLay
>ut (System.Windows.Forms.Control,string)
>in [0x000d4] (at
>/home/lmatter/mono/mcs/class/Managed.Windows.Forms/System.Wind
>ws.Forms/Control.cs:343) System.Windows.Forms.Control+ControlCollection:Add
>(Sy
>tem.Windows.Forms.Control value)
>in <0x00058> Form1:.ctor ()
>in (wrapper remoting-invoke-with-check) Form1:.ctor ()
>in <0x00018> Form1:Main ()
>
>Thanks,
>Larry Matter
>
>
>NEMO777 wrote:
>>
>> yeah Ive tried it.
>> Ive even tried this:
>> using System;
>> using System.Drawing;
>> using System.Windows.Forms;
>>
>> public class Form1 : Form
>> {
>> TextBox textBox1 = new TextBox();
>>
>> public Form1()
>> {
>> Controls.Add(textBox1);
>> }
>>
>> static void Main()
>> {
>> Application.Run(new Form1());
>> }
>> }
>>
>> and still no use! maybe Ive got something wrong in my system... but what?
>>
>--
>View this message in context:
>http://www.nabble.com/TextBox-error-t797793.html#a3662096
>Sent from the Mono - WinForms forum at Nabble.com.
>
>_______________________________________________
>Mono-winforms-list maillist - Mono-winforms-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>
>
More information about the Mono-winforms-list
mailing list