2

I am getting the following error in the error list of an ASP.NET web site opened in visual studio 2012.

enter image description here

And in the Error window there is no line number/file name and clicking on the error does not take me to a line of code.

enter image description here

This is a compile time, not runtime error. The code runs fine on the web server and used to work in VS2005 (on another computer until the drive failed). I just can't get it working in 2012.

Your help is greatly appreciated.

DaveG
  • 53
  • 6
  • That's a runtime error not a compile time error. Try setting your compiler to break on exceptions. – Liath Jun 13 '14 at 13:53
  • @Liath This is a website not a web application project (no project file), where do I set this option? – DaveG Jun 13 '14 at 13:58
  • In VS go to the menu then Debug, exceptions and it's the inner rows of checkboxes. When debugging your compiler will break when the exception is hit rather than when it's caught. – Liath Jun 13 '14 at 13:59
  • Just tried that with all exception types set, tried rebuilding and the website still does not compile. 4 more reputation points and I can show screenshot! – DaveG Jun 13 '14 at 14:04
  • Enough rep to add images now, question has been updated. – DaveG Jun 13 '14 at 14:33
  • 2
    @Liath this error is from the asp_net compiler, and a bug prevents Visual Studio from treating it as an error. I think it's a valuable question for our site and folks shouldn't be downvoting simply because they see "object reference not set to an instance of an object", making it easy to assume it's an inappropriate novice question. – Reg Edit Sep 26 '15 at 08:08
  • 1
    @RegEdit thanks for the clarification, glad they got an answer. However I wasn't the downvoter... – Liath Sep 27 '15 at 07:46

1 Answers1

3

I've had this in the past and it turned out Visual Studio was reporting an aspnet_compiler error as a "warning". Go to the Error List pane, and at the top there are toggle buttons for Error and Warning. Hit the Warning button till it shows you all the warnings, and you may well find the answer there.

It's also sometimes useful to run aspnet_compiler.exe from the command prompt, to see the output independently from the Visual Studio build.

Reg Edit
  • 6,719
  • 1
  • 35
  • 46
  • I'm getting that, too, and the Warnings aren't telling me much; if interested, see Update 7 at http://stackoverflow.com/questions/40875865/why-am-i-getting-object-reference-not-set-to-an-instance-of-an-object-but-no – B. Clay Shannon-B. Crow Raven Dec 05 '16 at 23:39