This project is read-only.

is there a chance for request.GetConfiguration() to return null inside HttpControllerDispatcher.SendAsyncInternal method

Topics: ASP.NET Web API
Jul 4, 2012 at 1:20 PM

Inside the HttpControllerDispatcher.SendAsyncInternal method, there is this block of code:

            // Set the controller configuration on the request properties
            HttpConfiguration requestConfig = request.GetConfiguration();
            if (requestConfig == null)
                request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, httpControllerDescriptor.Configuration);
                if (requestConfig != httpControllerDescriptor.Configuration)
                    request.Properties[HttpPropertyKeys.HttpConfigurationKey] = httpControllerDescriptor.Configuration;

There is a null check against request.GetConfiguration() result and I am wondering if there is a chance for this result to be null.

The GetConfiguration extension method simply looks up the Properties property of the request but I am wondering if anything else is responsible for putting the config inside Properties before the HttpControllerDispatcher is hit.

Jul 4, 2012 at 5:01 PM

The configuration is added in HttpServer [1] and even if it is null should be set here. What is the stack dump you see?



Jul 4, 2012 at 5:20 PM

thanks Henrik.