ploeh / Hyprlinkr

A URI building helper library for ASP.NET Web API
MIT License
197 stars 34 forks source link

Error When Generating Route - AttributeRouting #19

Closed mickdelaney closed 11 years ago

mickdelaney commented 11 years ago

Hi Guys.

I've been following the article here:

http://www.codedistillers.com/tja/2013/08/12/how-to-integrate-asp-net-webapi-attributerouting-with-hyprlinkr/#comment-4948

And am getting an error:

The route string returned by System.Web.Http.Routing.UrlHelper.Route(string, IDictionary) is null, which indicates an error. This can happen if the Action Method identified by the RouteLinker.GetUri method doesn’t have a matching route with the name “”, or if the route parameter names don’t match the method arguments.

Is that a common exception you've come across before?

Regards

ploeh commented 11 years ago

From the error message, it sounds like you are passing a null or empty route name from the Dispatch method.

When I look at the code listing in that link, there's at least three distinct ways in which routeName can be null. However, from that code alone, It's not entirely clear to me why you are getting that particular error message, because the Rouple constructor contains a Guard Clause against nulls - i.e. if routeName remains null when passed to the Rouple constructor, you should have gotten an ArgumentNullException instead.

Did you modify the Dispatch code, and if so, can you list your code here?

If not, I'll need some more information (preferably a repro) in order to be able to help.

ploeh commented 11 years ago

Did you find a solution to your problem?

mickdelaney commented 11 years ago

To be honest i've shelved it probably until next week or the week after. I'm selecting a web api framework to migrate too, i'll update this once i've sorted it, or you can close it if you want?

ploeh commented 11 years ago

If you expect to return to it in a week or to, I'll leave the issue open for now.

ploeh commented 11 years ago

I'm going to close this issue due to lack of activity, but you can always re-open it if need be.

mickdelaney commented 11 years ago

Yeah, sorry for not getting back to you. Not been focusing on web api for the past while. If i come back to it i'll pick this up again. thanks for your time regards