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

137
Views
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
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!