大家帮我看看关于“未处理的“System.NullReferenceException”类型的异常出现在 mscorlib.dll 中”这个问题怎么解决!
应用程序中发生了未处理的异常。如果单击“继续”,应用程序将忽略此此错误并尝试继续。如果单击“退出”,应用程序将立即关闭。
未将对象引用设置到对象的实例。。
以下是详细信息:
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参阅此消息的结尾。
************** 异常文本 **************
System.NullReferenceException: 未将对象引用设置到对象的实例。
at Microsoft.Win32.RegistryKey.GetValueNames()
at GCHG4.formConfig.ListAvailablePortNT()
at GCHG4.formConfig.formConfig_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&
m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
************** 已加载的程序集 **************
mscorlib
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
GCHG4
程序集版本: 1.0.4277.33201
Win32 版本:
基本代码: file:///C:/Program%20Files/GCHG4/GCHG4.exe
----------------------------------------
System.Windows.Forms
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__
b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e0
89/system.dll
----------------------------------------
System.Data
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561
934e089/system.data.dll
----------------------------------------
System.Drawing
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f
7f11d50a3a/system.drawing.dll
----------------------------------------
System.Windows.Forms.resources
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.windows.forms.resources/1.
0.5000.0_zh-
chs_b77a5c561934e089/system.windows.forms.resources.dll
----------------------------------------
HGGeneral
程序集版本: 1.0.3571.23657
Win32 版本:
基本代码: file:///C:/Program%20Files/GCHG4/HGGeneral.DLL
----------------------------------------
CustomControls
程序集版本: 0.0.0.0
Win32 版本: 0.0.0.0
基本代码: file:///C:/Program%20Files/GCHG4/CustomControls.DLL
----------------------------------------
MisInterface
程序集版本: 1.0.4277.33182
Win32 版本: 1.0.4277.33182
基本代码: file:///C:/Program%20Files/GCHG4/MisInterface.DLL
----------------------------------------
System.resources
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.resources/1.0.5000.0_zh-
chs_b77a5c561934e089/system.resources.dll
----------------------------------------
mscorlib.resources
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/mscorlib.resources/1.0.5000.0_zh
-chs_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
ListViewEx
程序集版本: 1.0.4277.33183
Win32 版本: 1.0.4277.33183
基本代码: file:///C:/Program%20Files/GCHG4/ListViewEx.DLL
----------------------------------------
HGPrt
程序集版本: 1.0.3588.18296
Win32 版本:
基本代码: file:///C:/Program%20Files/GCHG4/HGPrt.DLL
----------------------------------------
CrystalDecisions.Windows.Forms
程序集版本: 9.1.5000.0
Win32 版本: 9.1.9800.0
基本代码:
file:///c:/windows/assembly/gac/crystaldecisions.windows.forms/9.
1.5000.0__692fbea5521e1304/crystaldecisions.windows.forms.dll
----------------------------------------
System.Xml
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c5619
34e089/system.xml.dll
----------------------------------------
CrystalDecisions.CrystalReports.Engine
程序集版本: 9.1.5000.0
Win32 版本: 9.1.9800.0
基本代码:
file:///c:/windows/assembly/gac/crystaldecisions.crystalreports.e
ngine/9.1.5000.0__692fbea5521e1304/crystaldecisions.crystalreport
s.engine.dll
----------------------------------------
CrystalDecisions.Shared
程序集版本: 9.1.5000.0
Win32 版本: 9.1.9800.0
基本代码:
file:///c:/windows/assembly/gac/crystaldecisions.shared/9.1.5000.
0__692fbea5521e1304/crystaldecisions.shared.dll
----------------------------------------
CrystalDecisions.Windows.Forms.resources
程序集版本: 9.1.5000.0
Win32 版本: 9.1.9800.0
基本代码:
file:///c:/windows/assembly/gac/crystaldecisions.windows.forms.re
sources/9.1.5000.0_zh-
chs_692fbea5521e1304/crystaldecisions.windows.forms.resources.dll
----------------------------------------
CrystalKeyCodeLib
程序集版本: 9.1.5000.0
Win32 版本: 9.1.9800.0
基本代码:
file:///c:/windows/assembly/gac/crystalkeycodelib/9.1.5000.0__692
fbea5521e1304/crystalkeycodelib.dll
----------------------------------------
crdb_adoplus
程序集版本: 9.1.3300.0
Win32 版本: 9.1.0.25
基本代码: file:///C:/Program%20Files/Common%20Files/Crystal%
20Decisions/1.0/Bin/crdb_adoplus.dll
----------------------------------------
CrystalDecisions.ReportSource
程序集版本: 9.1.5000.0
Win32 版本: 9.1.9800.0
基本代码:
file:///c:/windows/assembly/gac/crystaldecisions.reportsource/9.1
.5000.0__692fbea5521e1304/crystaldecisions.reportsource.dll
----------------------------------------
System.Web.Services
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.web.services/1.0.5000.0__b
03f5f7f11d50a3a/system.web.services.dll
----------------------------------------
System.Web
程序集版本: 1.0.5000.0
Win32 版本: 1.1.4322.573
基本代码:
file:///c:/windows/assembly/gac/system.web/1.0.5000.0__b03f5f7f11
d50a3a/system.web.dll
----------------------------------------
CrystalDecisions.Shared.resources
程序集版本: 9.1.5000.0
Win32 版本: 9.1.9800.0
基本代码:
file:///c:/windows/assembly/gac/crystaldecisions.shared.resources
/9.1.5000.0_zh-
chs_692fbea5521e1304/crystaldecisions.shared.resources.dll
----------------------------------------
************** JIT 调试 **************
计算机的配置文件(machine.config)的
system.windows.forms 节中必须设置 jitDebugging 值。
编译应用程序时还必须启用\r\n调试。\r\n\r\n例如:
\r\n\r\n<configuration>\r\n <system.windows.forms
jitDebugging="true" />\r\n</configuration>\r\n\r\n启用 JIT 调试后
,任何未处理的异常\r\n都将被发送到此计算机上注册的 JIT 调试器,
\r\n而不是由此对话框处理。\r\n
[解决办法]
代码有点长,你打一个断点,跟踪一下看看,是哪句代码出现问题,出的什么问题。
[解决办法]
unsafe 标示一下
[解决办法]
最上面的错误提示很明显,注册表缺少键值
[解决办法]
蛋疼。。。。看不懂