跟踪间歇性的“对象引用未设置为对象的实例."构建错误

Tracking down intermittent #39;Object reference not set to an instance of an object.#39; error on build(跟踪间歇性的“对象引用未设置为对象的实例.构建错误)
本文介绍了跟踪间歇性的“对象引用未设置为对象的实例."构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用一些帮助来追踪我在 ASP.Net 项目中一直存在的间歇性错误.

I could use some help trying to track down an intermittent error that I've been having with our ASP.Net project for quite some time.

在构建解决方案时,构建会间歇性地失败,并出现错误/: Build (web): Object reference not set to an instance of an object".该错误没有关联的文件、行、列或项目信息.这个错误的奇怪之处在于它会在连续的重建中消失,并且似乎不会导致我们在构建成功后遇到的任何运行时错误.有时错误只会弹出一次,有时会弹出 3-4 次,但最终构建将成功完成,然后似乎每次构建都很好.我无法确定错误发生的原因和时间,而且由于它总是最终生成,因此对我们来说并不是一个关键问题.只是一个烦恼.但我想要的一个原因很明显.

Intermittently when building the solution, the build will fail with the error "/: Build (web): Object reference not set to an instance of an object." The error has no associated file, line, column or project information. The weird thing about the error is that it will go away on successive rebuilds and doesn't seem to result in any run-time errors that we've come across once the build is successful. Sometimes the error will pop only once, sometimes 3-4 times, but eventually the build will finish successfully and then seems to build just fine each time after. I haven't been able to nail down a pattern as to why and when the error will happen, and since it always eventually builds it hasn't been a critical problem for us. Just an annoyance. But one that I want gone for obvious reasons.

我想我应该补充一点,这是一个最初在 ASP.net 1.1 中开发并转换为 2.0 的应用程序,之后我在某个地方继承了它,所以我不知道问题最初是什么时候出现的.就这里的每个人而言,它一直都在那里.

I guess I should add that this is an application that was originally developed in ASP.net 1.1 and converted to 2.0 and I inherited it somewhere down the line after that, so I don't know when the problem originally surfaced. As far as everyone here is concerned, it's always been there.

显然,我不希望有人找出我的问题的原因,因为这需要他们查看我们的整个解决方案以找出潜在的问题.只是希望有人能给我一些关于如何追踪代码中错误的实际来源的新想法.它一定来自某个地方,对吧?你会如何去找出哪里?

Obviously I'm not expecting someone to pick out the cause of my problem as that would require them to look at our entire solution to pick out potential problems. Just hoping someone can give me a couple fresh ideas as to how to go about tracking down the actual source of the error in code. It has to be coming from somewhere, right? How would you go about finding out where?

推荐答案

在命令行运行这个命令,看看能不能得到一些更详细的信息

Run this command at the command line and see if you get some more detailed information

%WINDIR%Microsoft.NETFrameworkv3.5msbuild.exe YourSolution.sln/v:n

%WINDIR%Microsoft.NETFrameworkv3.5msbuild.exe YourSolution.sln /v:n

这篇关于跟踪间歇性的“对象引用未设置为对象的实例."构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
How to Create such a Task Panel?(如何创建这样的任务小组?)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)