|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Toolstrip Exception - bad .NET?ours). I have determined that it goes down on this line of code: ToolStrip x = new ToolStrip(); I created a simple test app that only performs this one line of code. It throws an exception so I know the problem is not caused by something in my code. It seems like there is a problem with .NET. We have tried uninstalling and reinstalling .NET 2, but it doesn't help. Please, please, please, does anybody have any ideas? The following is the exception info from my test app... "Parameter is not valid" See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.ArgumentException: Parameter is not valid. at System.Drawing.Font.GetHeight(Graphics graphics) at System.Drawing.Font.get_SizeInPoints() at System.Drawing.SystemFonts.FontInPoints(Font font) at System.Drawing.SystemFonts.get_MenuFont() at System.Windows.Forms.ToolStripManager.get_DefaultFont() at System.Windows.Forms.ToolStripItem.get_Font() at System.Windows.Forms.ToolStripItemInternalLayout.CommonLayoutOptions() at System.Windows.Forms.ToolStripDropDownButton.ToolStripDropDownButtonInternalLayout.CommonLayoutOptions() at System.Windows.Forms.ToolStripItemInternalLayout.GetLayoutData() at System.Windows.Forms.ToolStripItemInternalLayout.PerformLayout() at System.Windows.Forms.ToolStripDropDownItem.OnBoundsChanged() at System.Windows.Forms.ToolStripItem.SetBounds(Rectangle bounds) at System.Windows.Forms.ToolStripOverflowButton.SetBounds(Rectangle bounds) at System.Windows.Forms.ToolStripItem.set_Size(Size value) at System.Windows.Forms.ToolStrip.get_OverflowButton() at System.Windows.Forms.ToolStripSplitStackLayout.get_OverflowButtonSize() at System.Windows.Forms.ToolStripSplitStackLayout.LayoutHorizontal() at System.Windows.Forms.ToolStripSplitStackLayout.LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs) at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs) at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent) at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent) at System.Windows.Forms.ToolStrip.OnLayout(LayoutEventArgs e) at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args) at System.Windows.Forms.Control.PerformLayout() at System.Windows.Forms.Control.ResumeLayout(Boolean performLayout) at System.Windows.Forms.ToolStrip..ctor() at WindowsApplication2.Form1.button1_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.832 (QFE.050727-8300) CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll ---------------------------------------- WindowsApplication2 Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/NextGen/WindowsApplication2.exe ---------------------------------------- System.Windows.Forms Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.832 (QFE.050727-8300) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.832 (QFE.050727-8300) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Drawing Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.832 (QFE.050727-8300) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration> <system.windows.forms jitDebugging="true" /> On Oct 9, 1:05 pm, Mike <MLM***@hotmail.com> wrote:
> I have a program that is crashing on some machines (at a client of Well, it looks like this is happening within a button click, which> ours). I have determined that it goes down on this line of code: > > ToolStrip x = new ToolStrip(); > > I created a simple test app that only performs this one line of code. suggests that it performs more than that one line of code. Could you post a short but complete program demonstrating the problem? See http://pobox.com/~skeet/csharp/complete.html for more details. Jon Thanks for the quick response. You are correct. What I created was a
form application with a single button. The handler for the button click only does the one line of code. Since the time when I retrieved these exception details, I changed the app to make it simpler so I don't have that exact code. The new test app runs the bad line of code in the constructor within a try...catch and shows a message on the form based on the results. I get "succeeded" on my system, but "failed" on the client's system. Here is the new code... [Form1.cs] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication2 { public partial class Form1 : Form { public Form1() { try { ToolStrip x = new ToolStrip(); } catch (Exception) { lblResults.Text = "FAILED"; return; } lblResults.Text = "SUCCEEDED"; } } } [Form1.Designer.cs] namespace WindowsApplication2 { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (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.lblResults = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lblResults // this.lblResults.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblResults.Location = new System.Drawing.Point(12, 56); this.lblResults.Name = "lblResults"; this.lblResults.Size = new System.Drawing.Size(200, 32); this.lblResults.TabIndex = 0; this.lblResults.Text = "[results]"; this.lblResults.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(224, 144); this.Controls.Add(this.lblResults); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.Name = "Form1"; this.Text = "Framework Tester"; this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label lblResults; } } Show quote On Oct 9, 8:18 am, "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote: > On Oct 9, 1:05 pm, Mike <MLM***@hotmail.com> wrote: > > > I have a program that is crashing on some machines (at a client of > > ours). I have determined that it goes down on this line of code: > > > ToolStrip x = new ToolStrip(); > > > I created a simple test app that only performs this one line of code. > > Well, it looks like this is happening within a button click, which > suggests that it performs more than that one line of code. > > Could you post a short but complete program demonstrating the problem? > Seehttp://pobox.com/~skeet/csharp/complete.htmlfor more details. > > Jon Mike <MLM***@hotmail.com> wrote:
> Thanks for the quick response. You are correct. What I created was a That code will always fail - it doesn't run the InitializeComponent > form application with a single button. The handler for the button > click only does the one line of code. > > Since the time when I retrieved these exception details, I changed the > app to make it simpler so I don't have that exact code. The new test > app runs the bad line of code in the constructor within a try...catch > and shows a message on the form based on the results. I get > "succeeded" on my system, but "failed" on the client's system. Here is > the new code... code in the designer file. However, I wonder whether your client's machine doesn't have the appropriate font installed. On my box it's using "Segoe UI" as the font name - you might want to check whether that's installed on your client's machine. -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too Thanks Jon! I just heard back from our client that the font was the
problem. Windows thought the font was installed because it was in the registry but it really was not there. Deleting the registry key allowed the font to reinstall and everything is OK now. On Oct 9, 1:08 pm, Jon Skeet [C# MVP] <sk***@pobox.com> wrote: Show quote > Mike <MLM***@hotmail.com> wrote: > > Thanks for the quick response. You are correct. What I created was a > > form application with a single button. The handler for the button > > click only does the one line of code. > > > Since the time when I retrieved these exception details, I changed the > > app to make it simpler so I don't have that exact code. The new test > > app runs the bad line of code in the constructor within a try...catch > > and shows a message on the form based on the results. I get > > "succeeded" on my system, but "failed" on the client's system. Here is > > the new code... > > That code will always fail - it doesn't run the InitializeComponent > code in the designer file. > > However, I wonder whether your client's machine doesn't have the > appropriate font installed. On my box it's using "Segoe UI" as the font > name - you might want to check whether that's installed on your > client's machine. > > -- > Jon Skeet - <sk***@pobox.comhttp://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet > If replying to the group, please do not mail me too |
|||||||||||||||||||||||