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

138
Vistas
Blazor Javascript Interop Returns Null

I have a Javascript function which should (does) return a string. The issue is that the C# part is always null although I've verified the JS function IS returning a string.

Here's the Javascript function:

window.get_current_user = () => {
        Moralis.User.currentAsync().then(function (user) {
            var wallet = user.get('ethAddress');
            return wallet;
        });
    }

Here's the C# calling it

 private async void GetAddress()
 {
    var userAddress = await _js.InvokeAsync<string>("get_current_user");
    _js.InvokeVoidAsync("alert", userAddress);
 }

I've used the Chrome Dev Console dev tools to breakpoint at the line in which it returns the value and verified the value is correct and a string. enter image description here

I've also placed a breakpoint on the 4th line of the GetAddress function and see that the value of 'userAddress' is indeed null

enter image description 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