Calling async C# method from async JavaScript #598
Unanswered
Soundman32
asked this question in
Q&A
Replies: 1 comment
-
Hi @Soundman32,
It would be helpful to know how you're invoking your script code and awaiting its completion. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Are there any examples on how to call an async C# method from a JS script, and what the methods should look like?
For example, given the following code (ignore _logger, that works fine):
I've enabled TaskPromiseConversion:
using var engine = new V8ScriptEngine(V8ScriptEngineFlags.EnableTaskPromiseConversion);
And the C# method is declared like this:
public Task<TResponse> GetAsync<TResponse>(string url)
I can see
Start
in the log, but the GetAsync doesn't get called (I have a breakpoint on that line), andEnd
isn't in the log.Beta Was this translation helpful? Give feedback.
All reactions