Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

423
Vistas
Blazor JSInterop intermitant fail - Could not find ''

Every so often, when i load my page, i get this error, which stops my page from working.. Weird as i can load the page, 3-4 times and everything is fine, but when i try and refresh my page in quick succession i get this error..

STACK - Microsoft.JSInterop.JSException: Could not find 'search' ('search' was undefined). Error: Could not find 'search' ('search' was undefined). at http://localhost:26661/_framework/blazor.server.js:1:67390 at Array.forEach () at e.findFunction (http://localhost:26661/_framework/blazor.server.js:1:67350) at v (http://localhost:26661/_framework/blazor.server.js:1:69092) at http://localhost:26661/_framework/blazor.server.js:1:70038 at new Promise () at e.beginInvokeJSFromDotNet (http://localhost:26661/_framework/blazor.server.js:1:70011) at http://localhost:26661/_framework/blazor.server.js:1:26293 at Array.forEach () at e.invokeClientMethod (http://localhost:26661/_framework/blazor.server.js:1:26263) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at

Interop call -

protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            try
            {
                await Js.InvokeVoidAsync("search");
            }
            catch (Exception e)
            {
                ErrorIsHidden = false;
                ErrorDescription = e.ToString(); //Show error description on page
                StateHasChanged();
                throw;
            }
            
        }

JS -

function search(){$(document).ready(function () {
    $("#myInput").on("keyup", function () {
        var value = $(this).val().toLowerCase();
        $('div[data-role="apps"]').filter(function () {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
    });
});}

PS.. i also thought that try-catch would allow the program to continue functioning (obviously) without the search function in this case?

ON FURTHER TESTING

This is clearly not right, but the silly thing is if i again add the JS call to the catch - the JS actually loads.. my error shows up, but the app crashes still, but the JS works (obviously because the error has been registered by then).

Strange.. Not sure what the issue is here.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda