-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add validation to Router component to prevent both NotFound and NotFoundPage being set #62625
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
Conversation
…neously Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
Router.NotFoundPage
Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
…dation Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
@copilot, add one unit test to |
Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
Added unit test |
@copilot change the warning to throwing exception. Remove the warning pragma and change the |
…tion Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
Done. Changed the warning to throwing an exception, removed the pragma warning disable from the validation logic, and updated the test |
@copilot, in What's more, you did not finish the previous work:
|
Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
Done. Updated the test assets to conditionally use either NotFoundPage or NotFound fragment, removed the TestLogger implementation from RouterTest.cs since we're testing exceptions not warnings, and kept the necessary pragma warnings in the Log class for obsolete NotFound property usage. Commit: 0712e4c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work.
Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
In this PR:
Router.NotFoundPage
public Type NotFoundPage { get; set; }
->public Type? NotFoundPage { get; set; }
NotFound
render fragment inRouter
as deprecated.NotFound
andNotFoundPage
are defined, log a warning. Do it inRouter.SetParametersAsync
in if (NotFoundPage != null) condition. Use the logger that is available there, add a new method to private static partial class Log with warning level. In the warning message, underline that we preferNotFoundPage
to be used and thatNotFound
will be deprecated. We are disabling treating warnings as errors, so they have to be disabled in some places to fix the build.Fixes: #62409