dotnet / dotnet/aspnetcore

NavigationException doesn't have a useful message.

Open
#51,787 10 comments 0 reactions 0 assignees View on GitHub
area-blazor enhancement feature-blazor-navigation help wanted
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

this
https://github.com/dotnet/aspnetcore/blob/d8a3aa870862d01a8b3a3235f8dd7fc951dd8ff4/src/Components/Server/src/Circuits/RemoteNavigationManager.cs#L91

creates an exception like this
![image](https://github.com/dotnet/aspnetcore/assets/6385855/1d2af17d-153c-4d80-84c0-b23b3b458bb7)
with the URL in the Location field.

Ideally it should have a useful message that includes the URI, eg., "Could not navigate to https://localhost:7298/item/99"

the problem is that NavigationException is not overriding Message and ToString
https://github.com/dotnet/aspnetcore/blob/d8a3aa870862d01a8b3a3235f8dd7fc951dd8ff4/src/Components/Components/src/NavigationException.cs#L9

If we want to keep the URL out of the message for security reasons, it should at least have a message like "Could not navigate to the URL".

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.