Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

426
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!