Task factory issue
I've implemented a function using Task.Factory to call a third-party API for data recording. However, I've been encountering an intermittent issue where, at times, the function is not triggered as expected. Occasionally, the task seems to end before it even starts, and other times, the function never actually executes. This issue has persisted for several days, and I'm seeking a reliable solution to ensure consistent task execution.
22 Replies
That usually means something that should've been awaited, wasn't
A reliable solution to execute a
Task
is to await
it
We'll need to see some code, thoughIn the above code I'm facing the issue in ZohoPOAPI Method
Inside GuestEmail and propertyMail also I'm using the Task Factory
That's a lot of task factory usage
Why?
Also, you should be using
await Task.WhenAll()
not Tash.WaitAll()
I don't see you await anywhere in this method either, so I wonder why it's even async
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
we want so much program run in back ground after the API results , So only we have used the Task factory.
Okay, I think you are the genius in C#.
So kindly, Change my code which all seems to be like bug and give the correct version
It should work in all scenarios.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
We're not your dogs.
I haven't said it like that anywhere.
If you feels that, I'm not response for that.
I'm Requesting and seeking for help to resolve my problem.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
First, I'm not said that in anywhere.
Then if you feels it like harsh means.
I apologizes for that @TeBeCo
My issue in the code is only Task factory, the function is not triggered as expected. Occasionally, the task seems to end before it even starts, and other times, the function never actually executes
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Pauses the current thread for 1 second.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
after that the code execute
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
what you mean the method?
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
The method name is main
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
after the Console.WriteLine reach, The Task.Run will execute
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View