[ CategoryList.cs ] Object reference not set to an instance of an object.

Topics: Controls
Dec 21, 2011 at 2:45 PM
Edited Dec 21, 2011 at 2:49 PM

Hello All,

Work Item: http://blogengine.codeplex.com/workitem/12227

I keep getting this error:

Object reference not set to an instance of an object.

---------------------------------------------------------------------

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 124:                        {
Line 125:                            ul.RenderControl(hw);
Line 126:                            blogsHtml[blogId] = sw.ToString();
Line 127:                        }
Line 128:                    }


Source File: c:\HostingSpaces\BrianDavis\programmingsolution.net\wwwroot\App_Code\Controls\CategoryList.cs    Line: 126

-----------------------------------------------------------

 

I am using the standard CategoryList.cs  it had not been modified.

 

This is occurring 100's of times a day.

 

Seems like:

http://www.baidu.com/search/spider.html

http://www.bing.com/bingbot.htm

Is triggering most of them.

They are trying to get:

http://programmingsolution.net/default.aspx?tag=%2fVariable+Declaration

and other urls.

When I tried them my self don't get the error.

Only seeing them in the Logger and ELamh.

Seems like an "bot" only error I have not seen this error live myself yet. Try to create it but it won't.

So everybody take a look at your logger.txt file see if you see that error there too?

If so then vote for it here:

Work Item: http://blogengine.codeplex.com/workitem/12227

 

Thanks,

Brian Davis

Dec 22, 2011 at 8:53 PM

bump :)

Dec 26, 2011 at 6:09 PM

This is now causing a 503 error I think.

Website went down with a 503 and this was one of the last Errors before it went down.

 

Just not 100% sure if this was the cause or not.

Jan 2, 2012 at 12:26 AM

Still getting these errors.

Please help.

Coordinator
Jan 2, 2012 at 12:01 PM

That line 126 looks really solid to me -- so I'm not sure how/why the error is occurring.  You could try replacing line 126 with the code below which will log some additional details into logger.txt in the App_Data folder (assuming you have the standard Logger extension enabled).  I wrote the code without compiling it, so it's not tested, but should work.

try
{
	blogsHtml[blogId] = sw.ToString();
}
catch (Exception ex)
{
	string msg = "CategoryList error #1." + "\r\n";
	msg += "Message: " + ex.Message + "\r\n";
	msg += "blogId: " + blogId.ToString() + "\r\n";
	msg += "blogsHtml == null: " + (blogsHtml == null).ToString() + "\r\n";
	msg += "sw == null: " + (sw == null).ToString() + "\r\n";
	if (blogsHtml != null)
	{
		msg += "blogsHtml.Count: " + blogsHtml.Count.ToString() + "\r\n";
		msg += "blogsHtml.ContainsKey(blogId): " + blogsHtml.ContainsKey(blogId).ToString() + "\r\n";
	}
	if (sw != null)
	{
		msg += "sw.ToString(): " + sw.ToString() + "\r\n";
	}
	Utils.Log(msg);
}