1
votes

I want to use Blazor Component in my ASP.NET MVC App. So, I follow article like this one : https://fizzylogic.nl/2019/08/18/integrating-blazor-in-an-existing-asp-net-core-application/

The behavior is quite strange, because I have no errors in my console, and my breakpoint put in OnInitializedAsync is fired, but I never reach my breakpoint in OnAfterRenderAsync...

I put breakpoints in BuildRenderTree & OnParametersSet, all of them are fired. My parameters are correctly set, and the ShouldRender method returns true. I also add a StateHasChanged() in OnInitializedAsync, but my component is still not rendering.

For testing, I replace all my component code by and still nothing render...

2

2 Answers

2
votes

Use the new way of rendering components in mvc razor pages:

<component type="typeof(Namespace.Pages.Component)" render-mode="ServerPrerendered" param-AnyParameter="parameterValue" />
1
votes

I discover that loading blazor server client javascript file MUST be done in the bottom of the file. I was loading it in the of my HTML, which makes my component not rendering.

Moving it to my Scripts section of my razor view make it works !