【发布时间】:2012-06-19 08:25:46
【问题描述】:
我在运行代码时收到错误消息“Null reference exception was unhandled”和“Object reference not set to an instance of the object”。 p>
堆栈跟踪
> Excel1.exe!Excel1.Program.GetAllTemplateNames(string strParam, string strRetVal) Line 121 C#
Excel1.exe!Excel1.Program.ProcessInput(string strRetVal, string strFunctionName, string strParam1, string strParam2, string strParam3, string strParam4, Excel1.MWMClient.MWMServiceProxy.TemplateData tData, Excel1.MWMClient.MWMServiceProxy.TaskInstance tInstance, int tID) Line 77 + 0x23 bytes C#
Excel1.exe!Excel1.Program.Main(string[] args) Line 66 + 0x20 bytes C#
【问题讨论】:
-
能否请您提供该行(来自堆栈跟踪或使用调试器)? - 调试应该是一件微不足道的事情 - 但是在没有任何线索的情况下以人类的身份阅读和解释所有代码? ...
-
谢谢,但是 Linie 121 对应于哪一段代码? - 是的,我知道我很懒,我只是不想自己数 121 行,而你可以做一个简单的
- -
这一行列表
templateData = templateClient.GetAllTemplate(siteID).ToList();你可以在switch语句结束后的第一个方法中找到这一行:) -
为什么要在 for 循环中创建具有相同值的新
tData和tInstance实例?为什么不创建一个并重复使用?