Reputation: 364
I'm getting a bug in a production server. I know which line is, but I do not know which would be the one that is complaining of a "Object reference not set to an instance of an object." Something is null:
public string GetAgentType(HttpContextBase httpContextBase)
{
try
{
string userAgent = httpContextBase.Request.UserAgent.ToLower();
/*some code to return the agent type*/
}
catch(Exception ex)
{
/*..Log exception logic..*/
}
}
The method is called with the injected parameter ControllerContext.HttpContext from a controller class.
"string userAgent = httpContextBase.Request.UserAgent.ToLower();"
As I said not pretty sure which would be null; httpContextBase? Request? or UserAgent? or in which cases one of them could be null?
Upvotes: 0
Views: 131