未设置对象引用
我有一个 Asp.net-C# Web 应用程序,有 4-5 个相关项目,全部用 c# 编写。我正在使用.net 3.5。
我的问题是,当我尝试从解决方案运行我的应用程序时,它显示错误:
“错误 17 对象引用未设置为对象的实例”
当我构建/重建解决方案时,它将走吧。当我单击该错误时,它不会带我去任何地方。另一个有趣的事情是,没有指定错误的位置。
请帮忙。
I have a Asp.net-C# Web app, with 4-5 associated projects all written in c#. I'm using .net 3.5.
My problem is, when I try running my application from the solution, it shows an error:
"Error 17 Object reference not set to an instance of an object"
When I build/rebuild the solution, it will be gone. When I click the error it takes me no where. And another interesting thing is, there is no location specified for the error.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该错误意味着某个对象为空,并且您尝试调用该对象的方法或访问该对象的属性。
例如,此代码将给出相同的错误消息:
如果您找不到位置,并且由于某种原因没有任何堆栈跟踪,请尝试在您认为可疑的代码周围添加一个 try/catch 块,并查看是否错误是否存在。
另一个解决方案是仅添加一个断点,然后逐行浏览代码,直到它爆炸。
没有更多细节,这就是我能给你的最好建议。
The error means that some object is null, and you try to call a method or access a property on it.
For example this code will give the same error message:
If you can't find out where, and for some reason don't have any stack trace, try adding a try/catch block around the code you think is suspicious and see if the error is there or not.
Another solution is to just add a breakpoint, and go through your code line by line untill it explodes.
Without more details, that is the best advice I can give you.