Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

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

Closed
crwsolutions opened this issue Feb 28, 2024 · 2 comments

Comments

@crwsolutions
Copy link

When no route is found, the followin 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 therefore like to add global routing via Routing.RegisterRoute().

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

@jfversluis
Copy link
Member

Thanks for the suggestion! This is probably not something we're going to add for Xamarin.Forms anymore since it will go out of support on May 1st. You're welcome to open this suggestion for .NET MAUI if this is still something that needs improvement over there as well!

@jfversluis jfversluis closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2024
@crwsolutions
Copy link
Author

Copied the issue more or less to .Net maui dotnet/maui#20902

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants