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;
}
}
> > 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:
[quoted text clipped - 10 lines]
>
> Jon
Jon Skeet [C# MVP] - 09 Oct 2007 19:08 GMT
> Thanks for the quick response. You are correct. What I created was a
> form application with a single button. The handler for the button
[quoted text clipped - 6 lines]
> "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.

Signature
Jon Skeet - <skeet@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
Mike - 09 Oct 2007 22:35 GMT
Thanks for the reply. I'll check the font.
BTW, I'm a little confused by your comment that this code will never
work. It works on my machine. That code is straight from what dev
studio gives me when I create a new windows app project.
> > Thanks for the quick response. You are correct. What I created was a
> > form application with a single button. The handler for the button
[quoted text clipped - 18 lines]
> 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
Jon Skeet [C# MVP] - 09 Oct 2007 22:58 GMT
> Thanks for the reply. I'll check the font.
>
> BTW, I'm a little confused by your comment that this code will never
> work. It works on my machine. That code is straight from what dev
> studio gives me when I create a new windows app project.
No, it's not. Check the constructor. You got rid of the call to
InitializeComponent - indeed, it will throw a NullReferenceException
because lblResults is still null.

Signature
Jon Skeet - <skeet@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
Mike - 10 Oct 2007 13:54 GMT
My mistake. I thought you meant that the designer can't have the
InitializeComponent function.
The call is in my test app. I made a mistake when I copied the code
that caused it to be omitted. The correct constructor follows...
public Form1()
{
InitializeComponent();
try
{
ToolStrip x = new ToolStrip();
}
catch (Exception)
{
lblResults.Text = "FAILED";
return;
}
lblResults.Text = "SUCCEEDED";
}
> > Thanks for the reply. I'll check the font.
>
[quoted text clipped - 9 lines]
> 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
Mike - 29 Nov 2007 20:43 GMT
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.
> > Thanks for the quick response. You are correct. What I created was a
> > form application with a single button. The handler for the button
[quoted text clipped - 18 lines]
> 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