Unable to route to Blazor component pages in the client assembly
danroth27 opened this issue · 14 comments
When I try to create pages in the client project or a Blazor WebAssembly app built using .NET 8 Preview 6, routing to those pages fails.
Repro steps:
- Install .NET 8 Preview 6
- Clone https://github.com/mkArtakMSFT/BlazorWasmClientInteractivity
- Update https://github.com/mkArtakMSFT/BlazorWasmClientInteractivity/blob/main/src/Client/Counter.razor to make it a routable component:
@page "/counter"
- Update the
Router
to add the client assembly as an additional assembly:AdditionalAssemblies="new[] { typeof(Counter).Assembly }"
- Build and run the app
- Browse to /counter
Expected result: The counter page renders successfully and is interactive
Actual result: Browsing to the counter page results in a 404
I verified that this issue isn't specific to Blazor WebAssembly. I'm also unable to route to components in an RCL from the default Blazor Web App template:
Repro steps:
- Install .NET 8 Preview 6
- Create a new Blazor Web App
- Add an RCL project and reference it from the web app
- Update Component1.razor to have a route: `@page "/component1"
- Add the RCL as an additional assembly to the router:
AdditionalAssemblies="new[] { typeof(Counter).Assembly }"
- Build and run
- Try to browse to /component1
Expected result: Component1
renders when browsing to /component1
Actual result: 404 not found error.
Possibly a duplicate of #48875, although it's unclear to me how additional endpoints from other assemblies can be added when using MapRazorComponents
.
This is going to be addressed as part of #48767
@mkArtakMSFT
https://gyazo.com/1846f3be1a84f088f84ded1a4b9197e8
There is a problem in the counter, after clicking the value is 2x higher than it should be. Instead of 1,2,3, there are 2,4,6 etc..
Could it be a problem with the WASM + Server side connection?
@mkArtakMSFT https://gyazo.com/1846f3be1a84f088f84ded1a4b9197e8 There is a problem in the counter, after clicking the value is 2x higher than it should be. Instead of 1,2,3, there are 2,4,6 etc.. Could it be a problem with the WASM + Server side connection?
@Alerinos The Counter
component has an IncrementAmount
parameter that is set to 2 when the component is added to the Index.razor page.
I find a problem related to component rendering.
You can see a "blink" effect when the component is rendered.
The component also has a positioning problem.
Here's a video showing the problem:
https://streamable.com/tz9a1u
@danroth27 Sure, already opened. Sorry for the previous message in this issue
Not sure why this is closed. When working on large projects, it will be easier to isolate pages in different RCL, and deploy. It looks like this is not possible with current release.
Not sure why this is closed. When working on large projects, it will be easier to isolate pages in different RCL, and deploy. It looks like this is not possible with current release.
@muranag It's closed as a duplicate of #48767. See #49313 (comment)
Can we assume this will be addressed as part of RC1, which seemed to be mentioned above?
@mkArtakMSFT said: This is going to be addressed as part of #48767
Same question as @chassq. If @mkArtakMSFT says this is addressed in #48767 and that gissue is tagged as .NET 9 Planning
, does that mean that .NET 8 will remain broken for RCL Blazor pages?!
Same question as @chassq. If @mkArtakMSFT says this is addressed in #48767 and that gissue is tagged as
.NET 9 Planning
, does that mean that .NET 8 will remain broken for RCL Blazor pages?!
Sorry for the confusion here. In .NET 8 we've added APIs so that you can specify additional assemblies that have routable components, similar to how the Blazor Router works. We had hoped to handle this in a more automatic fashion using a source generator, but that work was too much to fit in .NET 8, so the source generator work was moved to .NET 9.
Hey @danroth27, thanks for the update. To clarify, based on your link to #49757, this will be addressed in RC1?
Thanks!