Fix for WebAPI2: Controller GET action with return type IHttpResultActio...

I have a controller GET action that returns IHttpResultAction decorated with CacheOutput attribute. When i try to execute the GET request i get the a System.NullReferenceException:

"Object reference not set to an instance of an object."
at WebApi.OutputCache.V2.CacheOutputAttribute.GetExpectedMediaType(HttpConfiguration config, ' HttpActionContext actionContext)

The problem is the content negotiator result is null when the return type of the action is a IHttpActionResult.
I have changed the GetExpectedMediaType in the CacheOutputAttribute class and it worked like a charm.

                if (negotiatedResult != null)
                {
                    responseMediaType = negotiatedResult.MediaType;
                    responseMediaType.CharSet = Encoding.UTF8.HeaderName;
                }
                else
                    return DefaultMediaType;