Skip to main content
added 104 characters in body
Source Link

I am updating a Blazor web assembly project from .NET 9 to .NET 10, and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client.

In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

I've tried every possible option and I don't understand why Microsoft doesn't allow this in .NET 10!

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}

I am updating a Blazor web assembly project from .NET 9 to .NET 10, and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client.

In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}

I am updating a Blazor web assembly project from .NET 9 to .NET 10, and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client.

In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

I've tried every possible option and I don't understand why Microsoft doesn't allow this in .NET 10!

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}
please use comment
Source Link
marc_s
  • 759.8k
  • 186
  • 1.4k
  • 1.5k

Blazor wtichwith .NetNET 10 mode: @rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

I am updating a Blazor WebAssemblyweb assembly project from .NET 9.NET 9 to .NET 10.NET 10, and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9.NET 9, when using this mode without prerendering, lifecycle methods such as OnInitializedOnInitialized and OnInitializedAsyncOnInitializedAsync were executed normally on the client. In

In .NET 10.NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}

Blazor wtich .Net 10 mode: @rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

I am updating a Blazor WebAssembly project from .NET 9 to .NET 10 and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client. In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}

Blazor with .NET 10 mode: @rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

I am updating a Blazor web assembly project from .NET 9 to .NET 10, and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client.

In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}

I am updating a Blazor WebAssembly project from .NET 9.NET 9 to .NET 10.NET 10 and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9.NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client. In .NET 10.NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}

I am updating a Blazor WebAssembly project from .NET 9 to .NET 10 and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client. In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}

I am updating a Blazor WebAssembly project from .NET 9 to .NET 10 and noticed a change in behavior with the following line of code:

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))

In .NET 9, when using this mode without prerendering, lifecycle methods such as OnInitialized and OnInitializedAsync were executed normally on the client. In .NET 10, however, these lifecycle methods are no longer triggered.

Does anyone know how to make them launch the same way as in the previous frameworks?

@page "/"

@using System.Security.Claims
@using shared_library.Layout
@using webapp_blazor.Client.Servicios;

@layout LayoutRaiz

@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
 
@inject Servicio_AuthenticationStateProvider_Wasm _Servicio_AuthenticationStateProvider
@inject NavigationManager _NavigationManager

@code {
    protected async override Task OnInitializedAsync()
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
    }

    protected async override void OnAfterRender(bool firstRender)
    {
        var authenticationState = await _Servicio_AuthenticationStateProvider.GetAuthenticationStateAsync();
        ClaimsPrincipal _ClaimsPrincipal = authenticationState.User;

        /*Otra forma de comprobar si esta validado*/
        if (!authenticationState.User.Identity.IsAuthenticated)
        {
            _NavigationManager.NavigateTo("/Autenticar_wasm");
        }
        else
        {
            _NavigationManager.NavigateTo("/Inicio_wasm");
        }
        
    }
}
added 1684 characters in body
Source Link
Loading
Source Link
Loading