-
Notifications
You must be signed in to change notification settings - Fork 10.3k
MapDynamicControllerRoute doesn't work with DefaultLinkGenerator #16965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ollieferns thanks for contacting us. @rynowak can you look into this? |
@javiercn @rynowak I cloned the source and had a look. The issue appears to me to be in RouteValuesAddressScheme around line 104
Because the endpoint is a IDynamicEndpointMetadata not a IRouteNameMetadata it doesnt consider the route. I made IDynamicEndpointMetadata inherit from IRouteNameMetadata as a fix. It fixed my issue but made 3 tests fail. If I get to the bottom of the issue, how would I go about submitting a PR? I would rather like this fixed. In the meantime, what is the best way of referencing my altered MVC assemblies instead of the default ones for my own project? |
Hi, any chance of a quick answer to this while the issue is being looked at? Is there an easy way to do this? Or do I need to add the MVC projects to my solution? Thanks, |
@rynowak @javiercn could somebody reach out to me please regarding this issue. It seems to me to be a fairly serious issue with endpoint routing. Happy to discuss privately if required but the total radio silence is a bit unnerving when trying to convince my powers-that-be that .net core and aspnet is a viable technology choice for what we are trying to do here. |
So as an update this still does not work in .NET 5.01 Preview. How depressing. No answers to my questions for 4+months and no fix. |
Same issue here, see Stack Overflow. Is there an update? Would a PR for this be considered? |
Thanks for suggesting help, @MaxHorstmann. |
I’m really glad to hear that this is being evaluated for .NET 5.0.0. In the meanwhile, at minimum, it’d be useful to acknowledge this limitation in the documentation. It took me a bit to isolate this behavior and discover this issue. (If I have a chance, I can look into submitting a PR for the documentation—though I’ll need to investigate the conventions for documenting feature limitations, as I’m not clear how that’s generally handled.) |
The existing `MapTopicAreaRoute()` extension method recently introduced (6c6ad74) requires, at minimum, an `areaName` parameter, and thus is limited to setting up routes for one individual area at a time. This extension doesn't (currently) accept any parameters, and will instead map _all_ areas to support the `{**path}` catch-all expected by the OnTopic CMS. It does this by implementing the new `TopicRouteValueTransformer` (865f26a) to automatically set the `controller` and the `rootTopic` routing variables to the `area` name, which is the convention we most frequently follow. As part of this, I also registered `TopicRouteValueTransformer` with ASP.NET Core dependent injection, as part of the `AddTopicSupport()` extension. Be aware that this implementation trips of a feature limitation of ASP.NET Core 3.0 which prevents e.g. `@Url.Action()` references from correctly returning values (see dotnet/aspnetcore#16965). Hopefully that will be resolved in ASP.NET 4.0.
…l areas The existing `MapImplictAreaControllerRoute()` extension method recently introduced (8a65c95) requires, at minimum, an `areaName` parameter, and thus is limited to setting up routes for one individual area at a time. This extension doesn't (currently) accept any parameters, and will instead map _all_ areas. It does this by implementing the new `TopicRouteValueTransformer` (865f26a) to automatically set the `controller` routing variable to the `area` name, which is the convention we most frequently follow. Be aware that, as with the recently introduced `MapTopicAreaRoute()` (762d229), this implementation trips of a feature limitation of ASP.NET Core 3.0 which prevents e.g. `@Url.Action()` references from correctly returning values (see dotnet/aspnetcore#16965). Hopefully that will be resolved in ASP.NET 4.0.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Hello, any news on this ? It's not woking also for razor pages with |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
(facepalm) |
any workarounds on this ? |
You have to glue your own link generation into things. To make it work you have to overwrite the default registered address schemes used by the link generator with versions that can handle whatever kind of link generation you need. (I've written it myself before, but it's closed source company code. Having to write it that way blows, to say the least.) Note also that the whole URL generation pipeline running through |
Thanks for contacting us. |
Describe the bug
The DefaultLink Generator (and the AnchorTagHelper) do not work when mapping dynamic routes. They do not find any routes and produce a null href.
To Reproduce
see v simple example here.
https://github.com/ollieferns/dynamiclinkgenissue
Further technical details
.NET Core SDK (reflecting any global.json):
Version: 3.1.100-preview2-014569
Commit: 4bd5d24d87
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100-preview2-014569/
Host (useful for support):
Version: 3.1.0-preview2.19525.6
Commit: 5672978d91
.NET Core SDKs installed:
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.100-preview1-014459 [/usr/local/share/dotnet/sdk]
3.1.100-preview2-014569 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0-preview1.19508.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0-preview2.19528.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0-preview1.19506.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0-preview2.19525.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
The text was updated successfully, but these errors were encountered: