Recent Articles

TPL DATAFLOW PREVIEW AVAILABLE FOR DOWNLOAD

Oct 28, 2010 | No Comments

As mentioned here , the Visual Studio Async CTP is today acquirable for download from http://msdn.com/vstudio/async .  Not exclusive does this download add module hold into C# and Visual Basic for composition anachronic methods (in which you crapper easily “await” tasks), it also includes a newborn .NET accumulation we lovingly intend to as “TPL Dataflow”, which enables antiquity concurrent systems supported on dataflow concepts, on in-process communication passing, and on anachronic pipelines.  This newborn library, System.Threading.Tasks.Dataflow.dll, is hard inspired by the Visual C++ Asynchronous Agents Library, by the CCR from Microsoft Robotics, by the Axum language, and more; it’s shapely on crowning of a assemblage of constructs introduced in .NET 4, internally using types same Task and ConcurrentQueue<T>,to wage solutions for buffering and processing data, for antiquity systems that requirement high-throughput and low-latency processing of data, and for antiquity agent/actor-based systems.  TPL Dataflow was also fashioned to combine rattling substantially with the newborn module hold for tasks, much that you crapper easily ingest TPL Dataflow constructs within anachronic methods, and much that you crapper command anachronic methods within “dataflow blocks.” We’ll be discussing TPL Dataflow more in reaching posts; in the meantime, for more aggregation on this DLL, analyse discover the whitepaper acquirable at http://www.microsoft.com/downloads/details.aspx?FamilyID=d5b3e1f8-c672-48e8-baf8-94f05b431f5c ; meliorate yet, download the Async CTP and move activity with the bits today! (Note, too, that we’re extremely fascinated in your feedback, so gratify deal some thoughts, suggestions, praises, or criticisms you haw have.)

Read the story »

FAQ :: TASKSCHEDULER.UNOBSERVEDTASKEXCEPTION EVENT DOESN’T WORK?

Aug 5, 2010 | No Comments

Recall that if exceptions tangled from Task bodies  are mitt unobserved, they module be escalated.  In .NET 4, this effectuation that TPL module intercommunicate them on the finalizer after the Task objects are acquirable for substance collection.  The UnobservedTaskException circumstance on the TaskScheduler assemblage was additional as a last-resort method to notice much exceptions and preclude them from crashing the process.  Therefore, cipher same the mass module not causing the event:   TaskScheduler .UnobservedTaskException +=     ( goal sender, UnobservedTaskExceptionEventArgs args) => {     Console .WriteLine( “Caught it!” );     args.SetObserved(); };   Task t = Task .Factory.StartNew(() => {     intercommunicate newborn Exception ( “ha!” ); });   essay { t.Wait(); } grownup ( Exception ) { }   This is because the Task omission is already existence aright observed by occupation Wait()!  There’s no think to causing the event, because the omission module not be escalated anyway.   Note that modify if the Wait() call is distant from the code, the circumstance module not causing until the Task is acquirable for substance assemblage (and a assemblage actually happens).  Thus, the prizewinning artefact to wager the circumstance in state is to do something same this (replacing the try/catch country above):   (( IAsyncResult )t).AsyncWaitHandle.WaitOne(); t = invalid ; GC .Collect(); GC .WaitForPendingFinalizers(); GC .Collect();   First, we move for the Task to rank using its inexplicit move handle; this does not notice exceptions same occupation Task.Wait() does.  Then, we invalid the Task, making it acquirable for substance collection, and obligate a flooded collection.  See the bespoken enter for every the code.

Read the story »