vs2010写的winform程序可以正常运行,做成setup安装后,在启动和关闭程序时。。。出现《未将对象引用设置到对象的实例》异常,怎么破


如题,写了一个winform
应用程序,在vs中启动、调试都没有问题,可是当我将这个程序做成setup安装包,并安装后,运行之出现异常,查看详情解释如下:
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。
************** 异常文本 **************
System.NullReferenceException: 未将对象引用设置到对象的实例。
在 ImageView.FormMain.Form1_Load(Object sender, EventArgs e)
在 System.Windows.Forms.Form.OnLoad(EventArgs e)
在 System.Windows.Forms.Form.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.Form.WmShowWindow(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
忽略该异常后,程序可以正常运行,但是当我关闭程序的时候,又出现类似的异常
详情如下
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。
************** 异常文本 **************
System.NullReferenceException: 未将对象引用设置到对象的实例。
在 ImageView.FormMain.FormMain_FormClosing(Object sender, FormClosingEventArgs e)
在 System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
在 System.Windows.Forms.Form.WmClose(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
求各路大神指点迷津,如果解决这个问题,看上去太恶心了。
...全文
相关推荐
vs2010 打包winform成EXE文件
NULL 博文链接:https://baobeituping.iteye.com/blog/1491410
VS2010写的程序在自己电脑可以运行、其他电脑上不能运行的解决方案
自己用Visual Studio 2010 旗舰版写了一个软件,在自己电脑上运行完全没有问题,但是拷贝到其他人电脑上之后不管双击还是以管理身份运行,均没有反应,进程管理器中相关进程也只是一闪而过
C#WinForm中CefSharp.Winform示例代码(VS2010、.net4.0)
C#WinForm中使用CefSharp.Winform的示例代码,开发环境为VS2010、.NET4.0。CefSharp.Winform版本为49.0.1
VS2010 WinForm制作安装包
详细讲解在VS2010上制作WinForm程序的安装包
使用VS_自带的打包工具,制作winform安装项目
使用VS_自带的打包工具,制作winform安装项目


