我写了一个简单的'hello world'应用程序,它在模拟器中运行良好,但当我尝试将其部署到设备时,它会在生成的代码中崩溃:
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);
}
如果我取消注释该行并在模拟器中运行它仍然可以正常工作,如果我将它部署到设备我得到一个运行时错误,日志没有多大帮助。
我已将编译器设置为将最新的.net ce发送到设备,它是Windows mobile 6.1 Motorola MC5590。
任何想法我可能做错了什么?