I've written a simple 'hello world' app which runs fine in an emulator, but when I attempt to deploy it to a device it crashes in generated code:
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(54, 153);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(133, 53);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(240, 268);
this.Controls.Add(this.button1);
this.Menu = this.mainMenu1; // **<-- RIGHT HERE, the error is: "ObjectDisposed Exception was unhandled"**
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
If I uncomment that line and run it in an emulator it still works fine, if I deploy it to the device I get a runtime error with a log that isn't of much help.
I've set the compiler to send the latest .net ce to the device, it's a Windows mobile 6.1 Motorola MC5590.
Any ideas what I could be doing wrong?
Turning the device off and on again solved the problem, whatever it was.