Closed tubededentifrice closed 10 years ago
I think I may have had the same issue. I did a pull request #27 .
I don't think it's the same issue, because you solved a "duplicate key exception" (as you state, btw), but I'm having a "Null reference exception". To be honest I've investigated this because it was only happening with dumb spiders.
Sorry about that, I didn't read in detail. I actually have gotten the null reference exception too, and it was with a spider. Since it crawls, I assume the issue is probably in the first two lines:
var actionName = context.RouteData.Values["action"].ToString();
var controllerName = context.RouteData.Values["controller"].ToString();
Spiders tend to break up a url so there may be some cases were an action isn't defined with he request (i.e http://myurlroot.com/somecontroller/someaction exists in a sitemap, a crawler may try http://myurlroot.com/somecontoller and if a default action isn't defined the value may be null in routedata). It would probably be best if the code checked for null on these route values. Short of that though, you could possibly look over your routes and my sure default actions are defined on all of them.
I think this is a duplicate of https://github.com/moonpyk/mvcdonutcaching/issues/19 (I don't know what #19 is closed since the issue remains).
The reported line seems wrong in my stack trace since there is no line 220 in https://github.com/moonpyk/mvcdonutcaching/blob/173519a3d89ef28a09cb2ae45df9a34c4438b716/DevTrends.MvcDonutCaching/KeyGenerator.cs ; and line 43 as reported on issue #19 can't thrown a null reference exception (maybe the line 36? would be fixed with a simple x.Key != null && ...
?)
I just uploaded a new release candidate of the package on nuget.org
It recently appeared, not really sure why. The error is random (impossible to reproduce), so probably it's a race condition or browser related. I'm unable to reproduce the error myself. I got 14 occurences accross only 3 IP, all having "Mozilla/5.0 (compatible; EasouSpider; +http://www.easou.com/search/spider.html)" as user agent and very strange post data (see below). It's not a big issue (nasty spider), but the exception shouldn't be thrown away.