Linked Questions

0 votes
1 answer
248 views

I have an async method that is throwing. This has no impact on my app, I see the exception in the debugger output window. I can turn on first chance exceptions and have the VS debugger catch it in ...
Luke Puplett's user avatar
  • 45.9k
212 votes
8 answers
86k views

This is not a duplicate of "How to safely call an async method in C# without await". How do I nicely suppress the following warning? warning CS4014: Because this call is not awaited, execution of ...
noseratio's user avatar
  • 62.1k
113 votes
4 answers
51k views

Is there any conceptual difference between the following two pieces of code: async Task TestAsync() { await Task.Run(() => DoSomeWork()); } and Task TestAsync() { return Task.Run(() =&...
avo's user avatar
  • 10.9k
22 votes
5 answers
18k views

I am working on a tcp server that looks something like this using synchronous apis and the thread pool: TcpListener listener; void Serve(){ while(true){ var client = listener.AcceptTcpClient(); ...
captncraig's user avatar
  • 23.3k
44 votes
3 answers
15k views

Consider this example: var task = DoSomething() bool ready = await DoSomethingElse(); if (!ready) return null; var value = await DoThirdThing(); // depends on DoSomethingElse return value + await ...
enzi's user avatar
  • 4,195
27 votes
4 answers
20k views

If I need to postpone code execution until after a future iteration of the UI thread message loop, I could do so something like this: await Task.Factory.StartNew( () => { MessageBox....
noseratio's user avatar
  • 62.1k
18 votes
1 answer
10k views

We have been using xUnit Framework in our project as test framework since the begining. Currently there are 2200+ unit tests in project and everything seems fine. But yesterday i decided to run unit ...
bahadir arslan's user avatar
22 votes
2 answers
11k views

I've been dealing quite a lot with async await lately (read every possible article including Stephen's and Jon's last 2 chapters) , but I have come to conclusion and I don't know if it's 100% correct. ...
Royi Namir's user avatar
  • 149k
18 votes
3 answers
16k views

Updated, I've now tried explaining the behavior I'm seeing, but it'd still be great to have an answer from a credible source about the unhandledRejection behavor. I've also started a discussion thread ...
noseratio's user avatar
  • 62.1k
8 votes
3 answers
3k views

I use a set of tasks at times, and in order to make sure they are all awaited I use this approach: public async Task ReleaseAsync(params Task[] TaskArray) { var tasks = new HashSet<Task>(...
Travis J's user avatar
  • 82.6k
16 votes
3 answers
5k views

I've got the following scenario, which I think might be quite common: There is a task (a UI command handler) which can complete either synchronously or asynchronously. Commands may arrive faster than ...
noseratio's user avatar
  • 62.1k
7 votes
3 answers
4k views

A common problem I've seen has been managing unhandled exceptions inside of tasks. They don't cause a crash, they happen silently, and I can't even get an event to trigger when the task fails! I've ...
John's user avatar
  • 575
4 votes
1 answer
8k views

In my windows phone 8.1 application I have a singleton service DataService which should once in a while be downloading some data. Meanwhile on UI I should be displaying the amount of data received. ...
foxanna's user avatar
  • 1,570
10 votes
2 answers
4k views

I am working on a C# project and want to make use of the UnhandledException event to catch any exceptions I may have missed in my project (hoping there won't be any but to be on the same side). I ...
Boardy's user avatar
  • 36.4k
10 votes
2 answers
2k views

The normal behavior for exceptions thrown from async Task methods is to stay dormant until they get observed later, or until the task gets garbage-collected. I can think of cases where I may want to ...
noseratio's user avatar
  • 62.1k

15 30 50 per page