Demystify Async and Await (Part 1 of 2)

Tuesday, March 29, 2016

Demystify Async and Await (Part 1 of 2) After seeing so many confusion speed abroad the industry, I had came to conclusion to write this post and demystify the behavior of async and await.   To many people is having to many wrong conceptions and theories about the functionality of async and await. It lead to great confusion and bad practices. In order to explain async and await I must go back to the basic and demystify Task.   Part 1 of this 2 part series will explain what really is Task and the confusion almost everybody...
no comments

Service Fabric Concept, Guidelines and Patterns #6-Deadlock

Saturday, February 20, 2016

Service Fabric Concept, Guidelines and Patterns #6-Deadlock this post is part of the Service Fabric’s series which covers Service Fabric’s concept, guidelines and common patterns. at this post we will discuss potential deadlock and good practice for avoiding it.   The idea for this post came while speaking with Jeffrey Richter from the Service Fabric team. When would you get deadlock on Service Fabric’s Actor Model? deadlock occurs when Actor A calls instance of Actor B and different call for Actor B (not recurrent) call the same instance of Actor A. A ---->...

Awaiting RX

Saturday, November 21, 2015

Awaiting RX this post discuss the meaning of awaiting RX stream. many languages including .NET embrace the concept of async / await. async / await on .NET is usually refer to Task, but Task in not the only await-able type in .net, in matter of fact there is a few type which can be awaited, one of those type is IObservable.   what happens when you’re awaiting IObservable? When awaiting IObservable the await schedule on completion and resume with the last value. for example: Code Snippet int i = await Observable.Range(0,...
one comment

Service Fabric Concept, Guidelines and Patterns #1

Friday, November 13, 2015

Service Fabric Concept, Guidelines and Patterns #1 this is the first post in series which focus on Service Fabric. the series covers Service Fabric’s concept, guidelines and common patterns.   What is Service Fabric? Service Fabric is new framework that can operate either on the cloud (Azure) or on premise. this framework enable to build solution from small parts (concept known as Micro-Services). Micro-Services can be thought as Object-Oriented for cloud (or distributed application). the most granular unit of Micro-Services called Actor. Actor is similar to class in the Object Oriented paradigm. group of Actor can be packed...

Challenge Quick Access (Links)

Friday, July 17, 2015

this is a quick access page to the Challenges Challenge #1: Buffer On Time, Count and Custom Trigger  http://blogs.microsoft.co.il/bnaya/2015/01/27/rx-challenge/ #2: Avoid Overlaps http://blogs.microsoft.co.il/bnaya/2015/02/05/rx-challenge-2/ #3: Suspend on faults throttle http://blogs.microsoft.co.il/bnaya/2015/03/06/rx-challenge-3/ #4: Create message from spitted chunks http://blogs.microsoft.co.il/bnaya/2015/03/25/rx-challenge-4/ #5: Exception Safe-Point http://blogs.microsoft.co.il/bnaya/2015/04/03/rx-challenge-5/ #6: Weak subscription  http://blogs.microsoft.co.il/bnaya/2015/04/10/rx-challenge-6/ #7: Where Async http://blogs.microsoft.co.il/bnaya/2015/07/11/rx-challenge-7/ #8: Suspend Buffering and flush http://blogs.microsoft.co.il/bnaya/2015/07/24/rx-challenge-8/ #9: Execute Async Until http://blogs.microsoft.co.il/bnaya/2016/08/16/rx-challenge-9-execute-async-until/ #10: DistinctUntilChanged with expiration period http://blogs.microsoft.co.il/bnaya/2016/08/19/rx-challenge-10-distinctuntilchanged-with-expiration-period/ #11: Semaphore Wait Async Like http://blogs.microsoft.co.il/bnaya/2016/09/08/rx-challenge-11/ #12: Task.Delay http://blogs.microsoft.co.il/bnaya/2017/04/14/task-delay-challenge/   Solutions #1: Buffer On Time, Count and Custom Trigger http://blogs.microsoft.co.il/bnaya/2015/01/31/rx-challenge-solution/ #2: Avoid Overlaps  http://blogs.microsoft.co.il/bnaya/2015/02/09/rx-challenge-2-solution/...
3 comments

TPL Dataflow Starvation

Saturday, April 19, 2014

TPL Dataflow Starvation UPDATE: The bug had fixed on version 4.5.24 (after more than a year since I report it) and now it is finally safe to use the fallback scenario . this post is dealing with TPL Dataflow issue that may cause starvation.the TPL Dataflow team aware of it, so we can expect it to be fix in the near future.until then, you should be aware of it in order to avoid potential starvation of some of your Dataflow Blocks. so when does it happens? the starvation will happens when you have 2 blocks which is linked...

Async / Await for .NET 4, Silverlight and Windows Phone

Tuesday, May 7, 2013

Async / Await for .NET 4, Silverlight and Windows Phone if you have to target .NET 4, Silverlight and Windows Phone and still want to use the async / await pattern. the BCL team provide you with a new NuGet package named Microsoft.Bcl.Async. this package was announced as stable a few week ago. so you can check it out if you're having VS 2012 but should target one of the above platforms. be aware that this package won't work with 2010.
no comments

EF 6: Async

Tuesday, March 19, 2013

EF 6: Async this post is the first in a series about what's new in EF 6. great improvements are about to come with Entity Framework 6. it is a major release and the first one since EF become an open source. each post in the series will be dedicate to a single feature. this post will focus on a new EF a-sync features. the first question that should be asked is, why do we need parallel data access? moreover why...

Parallel and The C# Memory Model

Wednesday, March 6, 2013

Parallel and The C# Memory Model Parallel programming can be tricky, both compiler and CPU's optimization can lead into a twilight zone's debugging. lets take the following code snippet snippet: Code Snippet class Program {     static void Main(string args)     {         Console.WriteLine("Start");         var u = new Util();         u.Exec();         Console.ReadKey();     } }   public class Util {     private bool _stop = true;     public void Exec()     {         Task t = Task.Run(() =>             {                 bool b = true;                 while (_stop)                 {                     b = !b;                 }                 Console.WriteLine("Complete {0}", b);             });         Thread.Sleep(30);         _stop = false;     } } ...