14
votes
1answer
4k views

What is better for Lazy-Loading Navigation Properties of detached Self-Tracking Entities through a WCF service?

I have a WCF client which passes Self-Tracking Entities to a WPF application built with MVVM. The application itself has a dynamic interface. Users can select which objects they want visible in their ...
8
votes
2answers
701 views

Am I overlooking anything with this asynchronous read/write loop?

Here's my code: public static void CopyStream(Stream input, Stream output) { var size = 8192; var inBuffer = new byte[size]; var outBuffer = new byte[size]; IAsyncResult writeAsync ...
8
votes
4answers
427 views

Code works but memory usage is erratic

I have the following class which is a tool for retrieving MD5 hashes of files that are input into it. They can potentially be very large files and I require cancellation and progress report, hence why ...
6
votes
1answer
103 views

AutoResetEventAsync, am I missing something?

So I wrote an asynchronous version of AutoResetEvent: public sealed class AutoResetEventAsync { private readonly Task<bool> falseResult = Task.FromResult(false); private readonly ...
6
votes
2answers
949 views

Real World Async and Await Code Example

I have been looking everywhere to find good real world examples of the new Async and Await features in .net 4.5. I have come up with the following code to download a list of files and limit the number ...
4
votes
1answer
368 views

A blocking buffer manager to provide segments of a byte array

Since asynchronous operations (like Socket's Begin*-End* pairs and *Async methods) that use IOCP under the hood cause the byte array that you use as buffer to be pinned in the memory. So if you ...
3
votes
1answer
702 views

File Async writer using Tasks or new features of .Net 4.5?

This code was posted as answer to Async file writer in .Net 3.5, My question is how would it be done better using Tasks or new features in .Net 4.5? public sealed class Logger : IDisposable { ...
3
votes
4answers
966 views

Asynchronous website monitor

I have a class which is responsible for checking whether a website is up or down. I've made it to run asynchronously, but I would like critique if this is a good/bad way or if there is another better ...
3
votes
2answers
434 views

“Singleton” task running - using Tasks/await - peer review/challenge

My app saves data to a file - I obviously don't want the app to write to the file from multiple locations on disk. What I want is a generic "utility" class that will know how to run a piece of code ...
3
votes
1answer
114 views

Code Review of AsyncPages in ASP.NET 2.0

Could somebody code-review the implementation of Async in ASP.NET 2.0 web form page below and let me know If I am missing something in implementing in a correct way? AsyncPagesASPNET20.aspx <%@ ...
3
votes
2answers
188 views

TCP async socket server client communication feedback and review

I develop my first asyn tcp socket server and client program in c# and would like to review the first parts of it. I like to get some information’s about smelly code that I missed and what I could ...
3
votes
1answer
1k views

Asynchronous task runner: How can it be improved?

This is my personal project. This class is responsible for running jobs asynchronously that are registered using dependency injection. All improvement suggestions are welcome. It can be as small as ...
2
votes
2answers
2k views

Is this implementation of an Asynchronous TCP/UDP Server correct

I am trying to implement a TCP/UDP server so all I have to do is something like this: var server = new Server(Type.UDP, "127.0.0.1", 8888); server.OnDataRecieved += Datahandler; server.Start(); I ...
2
votes
1answer
86 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) public async Task<FileInfo> RasterizeAllPdfs(IEnumerable<Uri> ...
2
votes
1answer
538 views

Correct approach to wait for multiple async methods to complete

I have an IWorkflow interface defined as follows: public interface IWorkflow { Task ConfigureAsync(); Task StartAsync(); Task StopAsync(); } And I have an Engine class: public sealed ...

1 2
15 30 50 per page