【问题标题】:Porting a winform app to monodevelop on mac将 winform 应用程序移植到 mac 上的 monodevelop
【发布时间】:2013-02-01 11:47:29
【问题描述】:

我正在尝试使用 monodevelop 将在 Visual Studio 中创建的 winforms 应用程序移植到 Mac。解决编译错误后,当我运行程序时,应用程序输出这些异常:

System.NullReferenceException: Object reference not set to an instance of an object
 at System.Windows.Forms.TextBoxBase.set_Lines (System.String[] value) [0x00000] in <filename unknown>:0

  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TextBoxBase:set_Lines (string[])

  at WindowsFormsApplication1.Main_Form.amp_portante_ValueChanged (System.Object Sender) [0x00025] in /Users/giuseppe/Desktop/CRUZER/Csound Converter/WindowsFormsApplication1/Main_Form.cs:381

  at KnobControl.KnobControl.OnValueChanged (System.Object sender) [0x00000] in <filename unknown>:0

  at KnobControl.KnobControl.set_Value (Int32 value) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) KnobControl.KnobControl:set_Value (int)
  at WindowsFormsApplication1.Main_Form.textb2_TextChanged (System.Object sender, System.EventArgs e) [0x00085] in /Users/giuseppe/Desktop/CRUZER/Csound Converter/WindowsFormsApplication1/Main_Form.cs:1023 
  at System.Windows.Forms.Control.OnTextChanged (System.EventArgs e) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.TextBoxBase.OnTextChanged (System.EventArgs e) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.TextBoxBase.set_Text (System.String value) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.TextBox.set_Text (System.String value) [0x00000] in <filename unknown>:0 
  at WindowsFormsApplication1.Main_Form.SimpleFM_Conf () [0x00058] in /Users/giuseppe/Desktop/CRUZER/Csound Converter/WindowsFormsApplication1/Main_Form.cs:45 
  at WindowsFormsApplication1.Main_Form.Main_Form_Load (System.Object sender, System.EventArgs e) [0x00012] in /Users/giuseppe/Desktop/CRUZER/Csound Converter/WindowsFormsApplication1/Main_Form.cs:359 
  at System.Windows.Forms.Form.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs e) [0x00000] in <filename unknown>:0

该应用程序在 Visual Studio 中完美运行,我不知道该怎么做。

【问题讨论】:

  • 尝试在Main_Form.textb2_TextChangedMain_Form.amp_portante_ValueChanged 中设置一个断点,看看你能不能从那里找出什么是空的。看起来你的 KnobControl 几乎是空的,但我不习惯单一开发堆栈跟踪,所以我很可能是错的 :)
  • 我放置了断点,应用程序停止了,但我不知道如何从这里看到什么是空的......我没有调试经验
  • 嗯,嗯,在 Visual Studio 中,鼠标悬停在变量上会显示值,不确定 MonoDevelop。
  • textb2 和 amp_portante 不为空,它们有一个 int 值
  • 你能把你的代码贴在 amp_portante_ValueChanged () 里面吗?

标签: c# winforms visual-studio monodevelop


【解决方案1】:

您可能有一个无法实例化的自定义控件 (KnobControl)。

也许你没有这个控件,或者这个控件不能用单声道编译。

查看 Main_Form.cs 中的第 381 行

问候,

【讨论】:

    猜你喜欢
    • 2014-05-04
    • 2012-05-01
    • 1970-01-01
    • 2013-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多