tagged [task]
In C#, I am calling a public API, which has a API limit of 10 calls per second
In C#, I am calling a public API, which has a API limit of 10 calls per second In C#, I am calling a public API, which has an API limit of 10 calls per second. API has multiple methods, different user...
- Modified
- 19 Jun at 12:31
is returning an empty static task in TPL a bad practice?
is returning an empty static task in TPL a bad practice? There are cases that I would want to run a task conditionally. I use some sort of extension method like this: ``` public static class MyTaskExt...
- Modified
- 22 Mar at 04:38
Task.Factory.FromAsync with CancellationTokenSource
Task.Factory.FromAsync with CancellationTokenSource I have the following line of code used to read asynchronously from a NetworkStream: I'd like to make it support cancellation. I see that I can [canc...
- Modified
- 27 Jul at 11:47
Canceling a task
Canceling a task I have a task which i need to cancel if the wait time is over. For instance But it seems the task still keeps working. I tried using CancellationTokenSource but that didnt seem to wor...
- Modified
- 22 Jun at 21:36
Waiting on a Task with a OnlyOnFaulted Continuation causes an AggregateException
Waiting on a Task with a OnlyOnFaulted Continuation causes an AggregateException I have some simple code as a repro: ``` var taskTest = Task.Factory.StartNew(() => { System.Threading.Thread.Sleep(50...
- Modified
- 4 Jul at 15:59
Task.Run with Parameter(s)?
Task.Run with Parameter(s)? I'm working on a multi-tasking network project and I'm new on `Threading.Tasks`. I implemented a simple `Task.Factory.StartNew()` and I wonder how can I do it with `Task.Ru...
- Modified
- 13 May at 21:27
Task.WhenAll and task starting behaviour
Task.WhenAll and task starting behaviour I've got a fairly simple application using Task.WhenAll. The issue I am facing so far is that I don't know if I should start the subtasks myself or let WhenAll...
- Modified
- 29 Oct at 09:3
Creating a task wrapper around an existing object
Creating a task wrapper around an existing object I have a method which returns a Task where the implementation may or may not need to perform a slow operation in order to retrieve the result. I would...
- Modified
- 14 Jan at 15:56
Why do we need ContinueWith method?
Why do we need ContinueWith method? Why do we need `Task.ContinueWith()` method. Cannot we just write that "continuation code" inside Task body?
- Modified
- 19 May at 09:37
How do I wait until Task is finished in C#?
How do I wait until Task is finished in C#? I want to send a request to a server and process the returned value: ``` private static string Send(int id) { Task responseTask = client.GetAsync("aaaaa")...
- Modified
- 15 May at 09:26
Task LongRunning side effects?
Task LongRunning side effects? If a Task is created using the LongRunning option are there any side effects as they do not use the ThreadPool
- Modified
- 27 Oct at 12:40
When is the System.Threading.Task useful?
When is the System.Threading.Task useful? I have used most of the Threading library extensively. I am fairly familiar with creating new Threads, creating BackgroundWorkers and using the built-in .NET ...
- Modified
- 19 Mar at 13:40
WaitAll vs WhenAll
WaitAll vs WhenAll What is the difference between `Task.WaitAll()` and `Task.WhenAll()` from the Async CTP? Can you provide some sample code to illustrate the different use cases?
- Modified
- 19 Aug at 09:55
Why Task finishes even in await
Why Task finishes even in await I have a problem in the following code: ``` static void Main (string[] args) { Task newTask = Task.Factory.StartNew(MainTask); newTask.ContinueWith ((Task someTask)...
- Modified
- 4 Sep at 06:44
How to cancel a Task using CancellationToken?
How to cancel a Task using CancellationToken? So I've this code: ``` //CancelationToken CancellationTokenSource src = new CancellationTokenSource(); CancellationToken ct = src.Token; ct.Register(() =>...
- Modified
- 24 Feb at 19:17
Difference between OperationCanceledException and TaskCanceledException?
Difference between OperationCanceledException and TaskCanceledException? What is the difference between `OperationCanceledException` and `TaskCanceledException`? If I am using .NET 4.5 and using the `...
- Modified
- 22 Oct at 14:30
TAP global exception handler
TAP global exception handler This code throws an exception. Is it possible to define an application global handler that will catch it? Using .net 4.5 / WPF
- Modified
- 14 Mar at 03:37
When to use TaskCreationOptions.LongRunning?
When to use TaskCreationOptions.LongRunning? I've wondered this for quite a while, but never really found the answer. I understand that it's a hint for the task scheduler where the task will run on, a...
- Modified
- 6 Jun at 16:40
Specifying a Thread's Name when using Task.StartNew
Specifying a Thread's Name when using Task.StartNew Is there a way to specify a Thread's name when using the `Task.StartNew` method
- Modified
- 7 Nov at 15:5
How to pass multiple parameter in Task
How to pass multiple parameter in Task I have a function GetPivotedDataTable(data, "date", "id", "flag") is returning data in Pivoted format. I want to call this method using Task but how to pass mult...
- Modified
- 3 Aug at 06:5
Does Task.WhenAll wait for all the tasks in case of exceptions
Does Task.WhenAll wait for all the tasks in case of exceptions I have two tasks. I run both of them with Task.WhenAll. What happens if one of them throws an exception? Would the other one complete?
- Modified
- 21 Mar at 10:15
Delay then execute Task
Delay then execute Task Quick question, I want to a second an without a return value. Is this the right way to do it? What happens to exceptions?
- Modified
- 6 Jan at 21:4
TPL TaskFactory.FromAsync vs Tasks with blocking methods
TPL TaskFactory.FromAsync vs Tasks with blocking methods I was wondering if there were any performance implications between using TPL `TaskFactory.FromAsync` and using `TaskFactory.StartNew` on blocki...
- Modified
- 16 Feb at 16:11
The return type of an async method must be void, Task or Task<T>
The return type of an async method must be void, Task or Task I have the following code here: ``` public async Dictionary GetLikelihoodsAsync(List inputs) { HttpClient client = new HttpClient(); s...
- Modified
- 4 Jan at 22:3
How to create a Task<> I can complete manually
How to create a Task I can complete manually In unit testing a component I need to verify how a component reacts to Tasks being completed at various times. How do I create a `Task` that I can resolve ...
- Modified
- 11 Jan at 19:37