The Wayback Machine - https://web.archive.org/web/20220215104307/https://github.com/dotnet/aspnetcore/issues/40243
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

Blazor Server - Ambiguous Routes when changing Base Path #40243

Open
1 task done
TomJD opened this issue Feb 15, 2022 · 0 comments
Open
1 task done

Blazor Server - Ambiguous Routes when changing Base Path #40243

TomJD opened this issue Feb 15, 2022 · 0 comments

Comments

@TomJD
Copy link

@TomJD TomJD commented Feb 15, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a solution, which is currently split in 3 different projects in order to achieve a simulation of micro-frontends.

  • Project.Common : This handles the layout for the other two projects. Just a razor class library.

  • Project.BlazorServerApp : This is a Blazor Server App with base path let's say pathA

  • Project.BlazorServerApp2 : This is a Blazor Server App with base path, let's say pathB

The two Blazor Server Apps have references to Common for their common layout.
BlazorServerApp has reference to BlazorServerApp2 as it will act as a base application for the other smaller apps, and loads the assemblies inside the App.razor component.

Each app can also be hosted independently as well, and will run on the start-up base path specified for each one.

However, when running BlazorServerApp with Index.razor being @page "/" and loading in BlazorServerApp2 with its Index.razor also being @page "/", an exception is returned for ambiguous routes.

Expected Behavior

BlazorServerApp starts running on https://domain/pathA
BlazorServerApp2 starts running on https://domain/pathB

If BlazorServerApp has a component with @page "/counter", this is https://domain/pathA/counter
If BlazorServerApp2 has a component with @page "/counter", this is https://domain/pathB/counter

Should not return an exception, as they are running under different base paths

Steps To Reproduce

No response

Exceptions (if any)

System.InvalidOperationException: The following routes are ambiguous:
'/counter' in 'BlazorServerApp.Pages.Index'
'/counter' in 'BlazorServerApp2.Pages.Index'

at Microsoft.AspNetCore.Components.RouteTableFactory.RouteComparison(RouteEntry x, RouteEntry y)
at System.Collections.Generic.ComparisonComparer1.Compare(T x, T y) at System.Linq.EnumerableSorter2.CompareAnyKeys(Int32 index1, Int32 index2)
at System.Collections.Generic.ArraySortHelper1.InsertionSort(Span1 keys, Comparison1 comparer) at System.Collections.Generic.ArraySortHelper1.IntroSort(Span1 keys, Int32 depthLimit, Comparison1 comparer)
at System.Collections.Generic.ArraySortHelper1.IntrospectiveSort(Span1 keys, Comparison1 comparer) at System.Collections.Generic.ArraySortHelper1.Sort(Span1 keys, Comparison1 comparer)

.NET Version

,NET 5

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants