How Can a Stack Trace Point to the Wrong Line (the “return” Statement) – 40 Lines Off

I have twice now seen a NullReferenceException logged from a Production ASP.NET MVC 4 web application – and logged on the wrong line. Not wrong by a line or two (like you would get with a PDB mismatch), but wrong by the length of the entire controller action. Example:

How to solve Object reference not set to an instance of an object.?

In my asp.net program.I set one protected list.And i add a value in list.But it shows Object reference not set to an instance of an object error protected List<string> list; protected void Page_Load(object sender, EventArgs e) { list.Add("hai"); } How to solve this error? Answers: Thank you for visiting the Q&A section on Magenaut. Please … Read more