Skip to content
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

[Enhancement] Add more descriptive exception for route not found (Shell.Current.GoToAsync). #20902

Open
crwsolutions opened this issue Feb 28, 2024 · 0 comments
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout t/enhancement ☀️ New feature or request
Milestone

Comments

@crwsolutions
Copy link

When no route is found, the following exception is thrown:

Relative routing to shell elements is currently not supported. Try prefixing your uri with ///: ///{originalRequest}

Because you are led astray by the hints in some situations I would suggest to rewrite it a bit and add another solution of global routing via Routing.RegisterRoute(). And when I am on it, I don't think that the first sentence is very helpful either. Because it's not entirely clear in some situations what it refers to. So I rather have something like 'Route not found.' So my suggestion would be to rewrite it to (I removed originalRequest because in my case that is very long and that could lead to TLDR;):

Route not found. Possible solutions could be prefixing your uri with '//' or '///' to use relative routing or register the route as global route for detail page routing.

This refers to:

throw new Exception($"Relative routing to shell elements is currently not supported. Try prefixing your uri with ///: ///{originalRequest}");

Navigation docs: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/navigation?view=net-maui-8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout t/enhancement ☀️ New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants