一位用户的生产 ASP.NET Web 应用程序错误,无法在开发中重现 - 我该如何调试?

发布于 2024-11-02 19:06:35 字数 506 浏览 0 评论 0原文

我继承了一个面向客户的 asp.net Web 应用程序,客户可以在其中将文件上传到我们的文件服务器。它适用于除一名个人之外的所有用户。两周前,她尝试上传文件并收到以下错误:

未将对象引用设置为对象的实例。

错误继续描述哪一行代码导致错误。然而,这是在我们的生产、外部环境中,并且我关闭了调试。因此,我假设这些信息或多或少都是废话(错误报告的代码行对我来说确实没有意义,因为它是错误的原因)。

我知道正在访问的某些内容为空,但我无法在我的开发环境中重现该错误,并且它对于我们的其他用户群来说工作正常。同一用户两周前遇到了该错误,然后昨天使用不同的文件再次尝试并收到了相同的错误。

我知道这一切听起来很模糊,但我想我的问题是,是否有人对如何跟踪用户的执行到错误有任何好主意,以便我可以准确地了解哪一行代码真正导致了错误?就像我说的,我无法在开发中、生产中、内部、外部重现该错误,并且没有其他用户遇到问题。我唯一的想法是向面向客户的生产站点发布调试版本,但我真的不想这样做。谢谢!

I inherited a customer facing asp.net web application, in which customers can upload files to our file servers. It works fine for all users except for one individual. Two weeks ago she tried to upload a file and received the following error:

Object reference not set to an instance of an object.

The error goes on to describe what line of code causes the error. However, this is in our production, external environment and I have debugging turned off. So this information, I am assuming is more or less bunk (the lines of code it the error is reporting really don't make sense to me as being the cause of the error).

I know something is being accessed that is null, but I have not been able to reproduce the error in my development environment and it works fine for the rest of our user base. The same user experienced the error two weeks ago, and then tried again yesterday with a different file and received the same error.

I know this all sounds very vague, but I guess my question is does anyone have any good ideas of how to trace the user's execution to the error so that I can get an accurate look of what line of code is REALLY causing it? Like I said I have not been able to reproduce the error, in dev, in production, internally, externally, and no other users have had a problem. My only idea was to publish a debug release to our customer facing production site but I don't really want to do that. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千纸鹤带着心事 2024-11-09 19:06:35
  1. 确定您在异常中获得的信息是错误的吗?做出这样的假设很容易,我们都做过,但当你花更长的时间观察它时,就会被证明是错误的。
  2. 确保您已部署 PDB(调试符号)。即使站点是在“发布”而不是“调试”中构建的,您仍然可以将它们推出,以确保您在堆栈跟踪中获得适当的行号。
    1. 确保部署匹配 .PDB 文件,不匹配的文件将没有任何用处。
    2. .PDB 文件与您的可发布文件一起置于版本控制之下,如果您同时拥有这两个文件以及该特定版本的代码(即对待您的编译后的输出和 .pdb 与您的源代码一样)。
  3. 使用 log4net 之类的东西向日志代码添加一些额外的工具(不要编写自己的日志系统 - 其他人比你或我更擅长!),在遇到问题的区域周围记录尽可能多的状态问题。
    1. 进行设置,以便可以根据配置设置打开或关闭日志记录。 log4net 可以轻松做到这一点。
    2. 确保您的日志记录代码在使用之前检查所有对象是否为 null,这样您就不会导致 NullReferenceException 通过您的日志代码。
  1. Are you SURE that the information that you're getting in the exception is erroneous? It's so easy to make that assumption, we've all done it, only to be proven wrong when you've spent a little longer looking at it.
  2. Make sure you've got PDB (Debug Symbols) deployed. You can still push these out even if the site is built in "Release", rather than "Debug" to ensure that you get appropriate line numbers in your stack trace.
    1. Make sure you deploy the matching .PDB files, ones that don't match won't be any use.
    2. Keep the .PDB files under version-control along with your releaseables, it makes it a lot easier to test issues if you have both, along with the code for that specific version (i.e. treat your compiled output and .pdb's as you would your source).
  3. Add some additional instrumentation to the code that logs, using something like log4net (don't write your own logging system - other people are better at it than you, or I!) that logs as much state as possible around the area that's encountering the issue.
    1. Make it so that the logging can be switched on or off based on a configuration setting. log4net makes it easy to do this.
    2. Make sure your logging code checks all objects that it inspects for null prior to using them, so you don't end up with a NullReferenceException being caused by your logging code.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文