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

learn more… | top users | synonyms

1
vote
0answers
12 views

Implementing TAP around WMI

I'm trying to improve my skills with the Task-based Asynchronous Pattern (TAP), by writing simple task-based wrappers around some WMI methods. Here's my first stab at it: ...
2
votes
1answer
52 views

Downloading data using HttpClient

I'm working on a class to download some data from an external server and feed it into my data model. I'm new to both HttpClient and ...
7
votes
1answer
89 views

Looping until browser document is ready

I made a do...while loop in order to wait for the web browser to load completely in order to enter username and password. I don't know whether this impacts the ...
2
votes
1answer
144 views

Getting messages asynchronously using MailKit

I'm writing a prototype for an application that uses MailKit and imap to connect to gmail. It's the first time I've used MailKit and I'm a bit stumped around the best way to do this. Essentially, I ...
4
votes
2answers
120 views

Async & ContinueWith

I am implementing my own UnitOfWork for an EntityFramework-DataContext. I want to call ...
2
votes
1answer
112 views

C# Async and DataContext access

I'm using a DataContext to insert an object. Currently it's working, but I'm feeling things could be done better. Method is called from UI (Using Caliburn Micro Binding). IsBusy is a property used by ...
2
votes
2answers
109 views

Class for easier to read IProgress<Class> handling (Version 2.0)

This is an update to my question Class for easier to read IProgress handling and includes the suggestions from @svick, with one exception. It was also suggested to change the setter for ...
2
votes
1answer
180 views

Cancellable progress form using async/await

Introduction: For a project I'm working on I used a BackGroundWorker to lift some heavy tasks away from the UI thread and report progress. For this I created some ...
4
votes
1answer
104 views

Calling common async code from a derived method

I'm implementing a number of classes in C# that have async methods. However, each of these methods needs to implement some boilerplate code that is common to all. Therefore I've implemented the common ...
5
votes
1answer
448 views

Async SerialPort Wrapper

I've been working with the SerialPort class for a while, trying to figure out the best way to work with it, and especially adding support for Async-Await in C#. I ...
2
votes
1answer
82 views

Listening for several connections in an async method

Is there a better way to structure a method that returns a task that queues several inbound socket connections? ...
3
votes
1answer
168 views

Controlling a Windows Service from a WPF app

I have a WPF Control Panel app, where I'm trying to stay close to an MVVM architecture. The control panel (the "the CP") is for a WCF service ("the Scheduler"), hosted in a Windows Service ("the ...
2
votes
1answer
78 views

Finding a customer's gender

I have been playing with Async/parallel execution in entity framework for while. I'm not sure if I'm doing it right. I have two entity contexts: one for reading and one for writing. The reading ...
7
votes
3answers
160 views

Notifying the UI that Issues Were Found

Our Rubberduck VBA IDE Add In does some static code analysis, and then reports all of the found issues back in a gridview. This analysis can take a long time for larger projects and the UI appeared to ...
4
votes
1answer
221 views

Is this pattern of Task queueing acceptable?

The AsyncWorkerQueue class uses TPL Data Flow and Rx to async process and cancel work in a queue. It takes in a worker factory (Func) and executes it when its turn (or not if its scheduled to be ...
8
votes
2answers
415 views

Quicksort async vs serial

I am playing with async and I figured I'd write a parallel implementation of Quicksort while trying to look at various optimizations. I want to keep the generics ...
5
votes
2answers
85 views

Forced Async operation in a (event like) method

I have a piece of code that I am not feeling comfortable. I don't want to block the UI Read operation works synchronously (reading may broke 50 ms rule) Save operation supports async (returns ...
2
votes
1answer
105 views

A utility class for running up to two Tasks serially, where the last task to be queued “wins”

Edit: Use cases for this class - I needed this class in the case where I had processes I needed to execute (in the form of tasks - they were all asynchronous) that I needed to issue to a UI control ...
3
votes
1answer
117 views

Using list of tasks to obtain and cache data

I develop Windows Phone App with Prism framework (MVVM). I use data caching. To get data I use proxy service. Proxy service creates two ...
3
votes
1answer
196 views

Wait for System.IO.StreamReader.ReadLineAsync

I want to wait for a line to be read, but only for so long before timing out. This is what I came up with. Is there a better way to do it? ...
32
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
683 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 ...
3
votes
1answer
300 views

Asynchronous task and close sql connection

The following code compiles correctly: ...
3
votes
1answer
132 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
277 views

Work with nested task [closed]

I have Client and Server classes. The Server return a ...
5
votes
1answer
96 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
3k 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
196 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
4k 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
222 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
545 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 ...
7
votes
2answers
504 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
383 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
535 views

Tasks and WaitAll\WhenAll

Could you help me to speed up/optimize this code: ...
3
votes
1answer
273 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 ...
3
votes
1answer
1k views

Using dapper.net and repository pattern in Azure websites

I'm currently on Azure Websites & Azure SQL, some documentation recommends using Async as much as possible as cloud services higher latency and have chances of dropping traffic, but it's also ...
3
votes
1answer
336 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
734 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
909 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
698 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
311 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
142 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
88 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
143 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. ...
5
votes
2answers
3k 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 the following code: ...
3
votes
1answer
214 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
3k 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 ...
6
votes
1answer
3k 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
2k 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
3k 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 ...