Closed simonech closed 4 months ago
Hi there @simonech!
Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.
We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.
Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:
Wow, looking at the PR it seems like it was pretty complicate. Thanks for getting to bottom of it. The main issue was the content last chance finder that was setting the current node and then making it impossible to set a node in the custom controller as it was always overwritten by the one in the last chance one.
It did get a bit complicated yeah 😅 Turns out it's an issue that other CMSes has also run into.
But I just wanted to pop in and say thanks for the detailed reproduction steps, they were vital in solving the issue H5YR 🙌
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
13.3.0-rc, but it affects versions already before
Bug summary
If I create a custom MVC route, umbraco goes through all the content finders defined, and even via the last chance content finder. And then it executes my custom MVC route.
If I specify my own MVC route, I know what I want, and I want to go straight to my controller. This causes performance problems since the ContentFinderByRedirectUrl does a DB query to see if it matches some URL in the redirect tracking table. And if we have many custom content finder the performance hit is even bigger, especially since it also goes through the last chance content finder, which also gets ready to render the 404 page.
Steps to reproduce
To reproduce, just create a new project from scratch Install the DB and create a doctype with a property with title as alias
this in the program.cs file (i just add a lastchancefinder and the custom route with the find content method)
Then create a controller to handle that custom route
And finally the lastchancecontent finder
All code is copied almost verbatim from the custom routing pages in umbraco docs
Enabling debug in the logs you see the full list of content finder being hit, including the last chance one.
Expected result / actual result
When I call
/Page
I would expect to see see just my log entry from my controller (assuming Homepage is the value of the title property in my content[21:30:27 WRN] Page Controller: Homepage
while I get the full list of content finders being executed, even the last-chance content finder
Exactly the same happens even if I use a normal Controller that is not an Umbraco controller:
And same behaviour if I use a
Route["/Test"]
attribute instead of the endpoint. And even if I specify this endpoint outside of theapp.UseUmbraco
context.The only workaround I found is to add the custom mvc routes in the
ReservedPaths
settings so that Umbraco ignores them. But doesn't seems right