AspNet.Mvc.TypedRouting icon indicating copy to clipboard operation
AspNet.Mvc.TypedRouting copied to clipboard

Unable to extract constants from static field accesses

Open andrewlock opened this issue 4 years ago • 2 comments

I've been using this library without issue for some time, including in .NET Core 2.x apps, so thanks for that 🙂

However, I've just come across an issue with standard constants exposed as static fields like Guid.Empty and string.Empty. Basically, they are ignored during URL generation in ExpressionRouteHelper, in the MemberAccess branch:

https://github.com/ivaylokenov/AspNet.Mvc.TypedRouting/blob/2994a608364e4a110ec4e8d8eb4a26e5f2182564/src/AspNet.Mvc.TypedRouting/LinkGeneration/ExpressionRouteHelper.cs#L234-L246

As they're not a ConstantExpression, that branch returns null, no value is generated for the parameter, and link generation completely fails.

andrewlock avatar Jul 30 '19 06:07 andrewlock

Hi, thank you for your issue. Since I am overwhelmed with my other project https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc, I did not have a lot of time to support this one. Will try to publish a new package during the weekend. Thank you for your patience!

ivaylokenov avatar Sep 10 '19 13:09 ivaylokenov

Would you be able to publish an updated package @ivaylokenov? Yours is a really great project and the best library for this purpose but not really usable with ASP.NET Core MVC 3.1.

Piedone avatar May 31 '20 18:05 Piedone