Skip to main content

Questions tagged [async-await]

This covers the asynchronous programming model supported by various programming languages, using the async and await keywords.

0 votes
0 answers
23 views

Why does Meziantou.Analyzer suggest me to await GetManifestResourceStream?

Meziantou.Analyzer tells me to add an await in front of GetManifestResourceStream with info MA0042 Neither GetExecutingAssembly nor GetManifestResourceStream return a Task or Task. So why can I await ...
MxNbrt's user avatar
  • 573
-2 votes
0 answers
54 views

Why can await Task.Delay(1) block? [closed]

I hit a bug recently where the following call blocks: await Task.Delay(1); I clearly don't understand something about async/await because I assumed if my code is executing to the point it makes this ...
David Thielen's user avatar
2 votes
2 answers
85 views

Different thread with async/await

I've heard a lot about how a new thread is not created with async await. I decided to check what would happen if there was an while(true) in the main function and the asynchronous function. namespace ...
xzxolop's user avatar
  • 39
0 votes
0 answers
33 views

TCP Client NetworkStream ReadAsync Hanging

I am trying to implement TCP communication in a Windows Form App. The user clicks a button and a command is sent successfully, but I am having trouble getting the result of the command back using ...
Breadman10's user avatar
2 votes
1 answer
23 views

How to use the retry from Rxjs to my await function?

I have to return an await function from my code block, now when the await function is called and failed on the first try, I want to retry it again and if it failed on the second time.. I will show an ...
Daniiiii's user avatar
0 votes
2 answers
62 views

Using async/await with a service call

I'm having trouble understanding how to use async/await in this scenario. I have a function GetAdditionalProducts() that calls a service and returns a result. I call that function elsewhere where I ...
noclist's user avatar
  • 1,761
0 votes
1 answer
43 views

Why block catch() doesn't catch error, when I use "for await" cycle

The block catch(err){} in promiseAll function doesn't catch error. const promiseAll = async (promises) => { const result = []; try { for await (let element of promises) { result.push(...
Maksim's user avatar
  • 1
1 vote
0 answers
27 views
+50

How to immediately cancel an Asyncio Task that uses the Ollama Python library to generate an answer?

I'm using Ollama to generate answers from large language models (LLMs) with the Ollama Python API. I want to cancel the response generation by clicking the stop button. The problem is that the task ...
noocoder777's user avatar
0 votes
1 answer
21 views

How to do self-contained Lazy Initialization using async/await

I am trying to initialize a class asynchronously using dependency injection. I have seen this article https://blog.stephencleary.com/2013/01/async-oop-2-constructors.html but I am trying to initialize ...
Nick Tucker's user avatar
0 votes
1 answer
61 views

Consider the last promise in a chain for Resolve.all

I want to export HTML content from Confluence pages. Those can contain <img> tags with src attributes that are just usual hyperlinks. Since I want to export those as well I decided to replace ...
Adrian Föder's user avatar
0 votes
0 answers
19 views

Can I use a third-party library's blocking API on a Vert.x vertices that use virtual threads as their threading model?

Vert.x 4.5 has introduced the feature of virtual threads. In the official example code, the Future.await method is used to wait for synchronous results. I would like to know if I can avoid using this ...
liang li's user avatar
-1 votes
0 answers
25 views

Multithreading for Async function resulting into error in C# [duplicate]

I am new to this C# language. I have function in which I need to call an async function multiple times on separate thread. After the debugger hits WaitAll() or WhenAll() both are giving me below ...
Utkarsh Kendre's user avatar
1 vote
2 answers
42 views

'await' in nested sub-function does not wait, only top-level function's 'await' waits

There is a thread on this which didn't really answer my question and doesn't offer any practical solutions. I have a function that involves await and, depending on a condition in the result, it calls ...
gene b.'s user avatar
  • 11.5k
0 votes
1 answer
52 views

await Task.Delay(1) in OnInitializedAsync() never returning

This is in code that has been running fine for months. No changes. And all pages except 1 come up fine. But this one page, which has: protected override async Task OnInitializedAsync() { await ...
David Thielen's user avatar
-3 votes
0 answers
36 views

Fetch Api Call - JavaScript [duplicate]

How to use sync and await during fetch call in Javascript. I have a separate JS file like 'APIService.js' which used fetch api to external Url. function APIService(){ this.getData = asyn function(...
Lucifer's user avatar
  • 818

15 30 50 per page
1
2 3 4 5
1824