This covers the asynchronous programming support added to C# and VB in VS2012. This includes the async and await keywords.

learn more… | top users | synonyms

-5
votes
1answer
69 views

Sum up all my web requests and make them static [on hold]

Context: I'm currently developing an iOS app in C#. I have different view controllers and sometimes also another view controller needs to make the same web request. I don't want to hold a reference ...
28
votes
2answers
2k views

Simon Says: “Make me a pretty game”

In Memoriam Ralph H. Baer, co-inventor of the original "Simon" game, died Saturday December 6th 2014, at 92. With his passing, this friendly little challenge inadvertently became a memorial to ...
4
votes
1answer
78 views

Asynchronously wait for a task to complete and do some async action while waiting

I have a long-running task. My goal is to create a method that will allow me to: Asynchronously wait for this task to complete While waiting on a task, do some async action once in a while. This ...
2
votes
0answers
50 views

Asynchronous task and close sql connection

The following code compiles correctly: ...
3
votes
1answer
80 views

Compressing a stream asynchronously, and returning a byte[]

Assuming I have to leave the contract intact (take byte[] and return byte[]), what's the correct way to structure this ...
1
vote
1answer
64 views

Work with nested task [closed]

I have Client and Server classes. The Server return a ...
5
votes
1answer
47 views

Server that supports two types of connections

I'm wonder if my approach is correct. I'm trying to make a WinForms server that processes data from 3 sides: from bluettoh (InTheHand library) as source data which I need to process in server to ...
5
votes
2answers
202 views

Async/await and Task vs Task.Factory.StartNew and Result

I am working on creating some libraries for a project at work and I wanted to make sure I have this pattern correct. Assuming that the GetWidgets method is what I ...
2
votes
1answer
46 views

Reporting progress to main form's controls from within a threaded heavy task

I'm trying to figure out how to nicely write a Winforms app that reports the progress of completing a long task onto the main form's controls without causing Cross-thread op exceptions and such. So ...
2
votes
3answers
1k views

Simple SqlHelper which wraps ADO.NET methods

I am creating a simple SqlHelper which will simplify the ADO.NET method usage. Can someone please review this class for any issue or missing something? ...
2
votes
1answer
58 views

AsyncLazy disposal

I've made this extension method. Its purpose is to trigger the disposal of a value, stored in a Nito.AsyncEx AsyncLazy, as authored by @StephenCleary. Is this an ...
2
votes
1answer
120 views

Await and interactive Android ADB shell

I'm writing an app to let me interact and debug my android over USB using the android SDK and the ADB command. I create a Process with redirected input and output streams and basically run "ADB ...
6
votes
2answers
135 views

Retry loop for asynchronous HTTP requests

I've got a method that needs to PUT data to a web API. Sometimes the connection fails, so I needed a way to do retries, but if the retries fail, I still need to capture the exception and re-throw it. ...
5
votes
1answer
171 views

Is this SqlConnection / SqlCommand async wrapper both efficient and correct?

This is my first time writing async code, I intend to inject the interface IConnection into other classes in my project. Can you please tell me if the implementation class Connection, is the correct ...
2
votes
1answer
154 views

Tasks and WaitAll\WhenAll

Could you help me to speed up/optimize this code: ...
3
votes
1answer
122 views

Is this a sensible way to throttle duplicate requests in a HttpModule?

I'm writing a method to throttle duplicate requests taking place within multiple HttpModule instances within a web application. Currently I have the following ...
2
votes
1answer
593 views

Using dapper.net and repository pattern in Azure websites

I am pretty new to dapper.net and i would like to have some feedback on my current implementation. I'm currently on Azure Websites & Azure SQL, some documentation recommends using Async as much ...
3
votes
1answer
108 views

HttpWeb* and XmlReader Async?

I've run into the need to deserialize XML that returns from an http request. I've done some light work with XML deserialization in the past but that was against files on disk. While attempting to ...
8
votes
1answer
339 views

Asynchronous retry method

I've written an asynchronous retry method as an answer for this question. I'd like to get your opinion of the implementation and whether there are better ways to implement this. You could also ...
10
votes
2answers
340 views

Async wrapper around public API

Tear it apart. I'm mostly concerned around the appropriate use of ConfigureAwait(false), and possible poor handling and duplication of the ...
2
votes
1answer
251 views

Async method with multiple tasks

I'm trying to make my ASP.net Web API methods asynchronous. This method is in the Business Logic layer of my N-tier. I'm waiting for the result from my 1st task and use it on the 2nd task, but I ...
11
votes
2answers
262 views

Stack Exchange websockets wrapper

I've been writing a small library that allows for easy querying of the Stack Exchange websockets. I'm going to add an enum to replace the manual ...
3
votes
2answers
102 views

Asynchronous Pattern

I have an n-tier solution which consist of DAL,BL and a ASP.net WebAPI project. I'm new with Asynchronous Pattern and I'm trying to add it to my Framework. Am I doing asynchronous pattern correctly? ...
1
vote
1answer
48 views

ThreadSafe IsoStorageManager

This is a continuation of the last thread. I wanted to add a thread-safety and I was considering AwaitableCriticalSection and Task+Mutex. I ended up with mutex; it can be a bit slower but it would ...
4
votes
2answers
123 views

IsoStorageManager

A manager for a speedy async saving objects to isolated storage, using serialization from Newtonsoft.Json. A project to play with is here. ...
4
votes
2answers
938 views

Async and Error Handling

I need to delete a file when an error occurs during loading it. It is not allowed to perform async operations in a catch block. This has lead me to writing following code: ...
3
votes
1answer
102 views

Stopping a long-running asynchronous computation

I'm writing a program that will perform a long-running computation, gradually improving a solution. On top of that, there's a simple UI that basically allows the user to stop the computation (letting ...
6
votes
1answer
1k views

Writing highly asynchronous code

I am writing a new web service that will be performing a lot of large data load operations. To do so I am moving the data to a temporary table then merging the data in to the live data via a stored ...
4
votes
1answer
1k views

Async Queue Processing

I have a Queue that needs to try to process when anything updates in it (add, remove or update). However, I don't want any of the callers to wait while the ...
5
votes
2answers
1k views

Listen to multiple RabbitMQ queue by task and process the message

Single app which listen to multiple RabbitMQ queue and process the message. This is working fine but not sure this implementation is right one or I am missing something. Implementation is inspired ...
4
votes
1answer
1k views

Async TcpListener

I'm trying to implement a TcpListener using the TPL. I'm not sure If I'm doing everything correctly though. I'm trying to keep the code as small as possible as well. It all works fine in a console ...
1
vote
1answer
996 views

Simple async/await progress bar

In researching the new .NET Async and Await keywords in .NET 4.5, I created a simple example showing how to update a progress bar and a label while an async function is running. I also included how to ...
3
votes
1answer
2k views

Basic TCP server application in C# using async / await [closed]

I'm trying to get started with network and parallel programming in C#. I'm almost a complete novice in programming, so I'm looking for feedback on a small script I'm writing. The goal of the ...
8
votes
2answers
514 views

Using keywords async/await in database queries (Windows Phone 8)

I have a local database in Windows Phone 8 app. The app includes a lot of queries to the database and I don't want bad effect on the responsiveness of UI. For ...
2
votes
1answer
4k views

WPF async await TcpClient/TcpListener sample

I want to build a robust and highly scalable client server system. Here what I have so far(an echo server as my base of implementation) My Server ...
3
votes
1answer
1k views

Filtering a collection by an async result

I'm trying to do something like this: var loudDogs = dogs.Where(async d => await d.IsYappyAsync); The "IsYappyAsync" property would return a ...
1
vote
1answer
144 views

Converting a method to async

I have a method that calls a "bridge" for TraderMarketInfo. When info is received, it checks if info IsSet and raises an event. ...
7
votes
2answers
11k views

Console chat server

I'm just looking for feedback on correctness of my understanding of async/await. I'm curious about the Task.Run inside of the ...
1
vote
0answers
620 views

WCF using TAP without worrying about timeouts

I am really liking using the new TAP pattern in .net 4.5. And am updating some of my older projects to use it. One of the old patterns I used to use was to use EAP with WCF so I could have functions ...
3
votes
3answers
1k views

Asynchronous version of AutoResetEvent

This is my second attempt to create asynchronous version of AutoResetEvent. At first I tried to make it completely lock-less, but it turned out to be impossible. This implementation contains a lock ...
7
votes
1answer
5k views

C# 5 Async Await .Task.Factory.StartNew cancellation

I have the async code that implements cancellation token. It's working but Im not pretty sure if this is the right way to do it so I just want feedback about it. Here is the actual code: ...
2
votes
1answer
248 views

Am I using async C# correctly?

I have the following bit of code the calls out to two different command line components (each wrapped in their own Task) ...
3
votes
1answer
4k views

Use and understanding of async/await in .NET 4.5 +

I am just about to embark upon a massive job of multi-threading a cost-engine. I could use TPL of which I am very familiar, but would like to leverage the ...