Thursday, 5 September 2013

System.ArgumentException running Windows Forms program in Mono

System.ArgumentException running Windows Forms program in Mono

I wrote a Windows Forms application in C# using Visual Studio 2010. It has
a tab control with several pages. All pages work correctly in Mono with
the exception of one, which, when clicked on, causes the application to
terminate with the error displayed below. You can see the page start to
get drawn, then fail.
One note: the only items that are on this page that are not on the others
are a FlowLayoutPanel and a ProgressBar. There are no fonts that are not
on the other pages. I see ToolStripMenuItem mentioned below, but there is
no ToolStrip on the page.
Any help would be appreciated. Thanks.
System.ArgumentException: A null reference or invalid value was found
[GDI+ status: InvalidParameter]
at System.Drawing.GDIPlus.CheckStatus (Status status) [0x0009b] in
/root/mono-3.2.1/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:220
at System.Drawing.Graphics.GdipMeasureString (IntPtr graphics,
System.String text, System.Drawing.Font font, System.Drawing.RectangleF&
layoutRect, IntPtr stringFormat) [0x00053] in
/root/mono-3.2.1/mcs/class/System.Drawing/System.Drawing/Graphics.cs:1953
at System.Drawing.Graphics.MeasureString (System.String text,
System.Drawing.Font font, Int32 width, System.Drawing.StringFormat
format) [0x00031] in
/root/mono-3.2.1/mcs/class/System.Drawing/System.Drawing/Graphics.cs:1986
at (wrapper remoting-invoke-with-check)
System.Drawing.Graphics:MeasureString
(string,System.Drawing.Font,int,System.Drawing.StringFormat)
at System.Windows.Forms.TextRenderer.MeasureTextInternal (IDeviceContext
dc, System.String text, System.Drawing.Font font, Size proposedSize,
TextFormatFlags flags, Boolean useMeasureString) [0x000eb] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextRenderer.cs:263
at System.Windows.Forms.TextRenderer.MeasureText (System.String text,
System.Drawing.Font font, Size proposedSize, TextFormatFlags flags)
[0x00000] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextRenderer.cs:117
at System.Windows.Forms.ToolStripItem.OnParentChanged
(System.Windows.Forms.ToolStrip oldParent,
System.Windows.Forms.ToolStrip newParent) [0x00000] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs:1202
at System.Windows.Forms.ToolStripItem.set_Parent
(System.Windows.Forms.ToolStrip value) [0x0001a] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs:853
at (wrapper remoting-invoke-with-check)
System.Windows.Forms.ToolStripItem:set_Parent
(System.Windows.Forms.ToolStrip)
at System.Windows.Forms.ToolStripItemCollection.Remove
(System.Windows.Forms.ToolStripItem value) [0x00035] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItemCollection.cs:273
at System.Windows.Forms.ToolStripItem.Dispose (Boolean disposing)
[0x0003b] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs:962
at System.Windows.Forms.ToolStripDropDownItem.Dispose (Boolean
disposing) [0x00089] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDownItem.cs:185
at System.Windows.Forms.ToolStripMenuItem.Dispose (Boolean disposing)
[0x00000] in
/root/mono-3.2.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs:221
at System.ComponentModel.Component.Finalize () [0x00000] in
/root/mono-3.2.1/mcs/class/System/System.ComponentModel/Component.cs:100

No comments:

Post a Comment