mono/mono — pull request #435 by svick (2012-08-19 23:52:01+00:00)
Title: Svick/dataflow

This pull request contains all of the changes from my Google Summer of Code 2012 project Finish .NET 4.5 TPL Dataflow.

TPL Dataflow is a library for writing concurrent applications using “blocks” that communicate using messages. Its implementation in mono was started by Jérémie Laval in a GSoC project last year and this year I finished this work.

Before this summer, the library was far from finished: one block type was missing, the existing blocks didn't support options or asynchronous (`Task`-returning) delegates, many methods worked correctly only in common cases and there were only few tests.
Now, all of that is fixed. The library looks the same as the MS version (for details see below) and, to the best of my knowledge, it also behaves the same (as evidenced by tests).

All 207 tests (most of them new) pass for me on:
- MS version of TPL Dataflow on MS.NET 4.5 RC (to check the tests)
- this version of TDF on MS.NET 4.5 RC
- this version of TDF on mono 2.11.2 - built from source (using `make run-test`)

When I use `gui-compare` to compare this version of TDF and version 4.5.5-rc from NuGet, I get the following differences:
- missing `DebuggerDisplay` and `DebuggerTypeProxy` attributes on classes:
they are useful only for debugging
- extra implementation of `IEquatable` by `DataflowMessageHeader`:
I think this is false positive, that interface should be implemented; on further inspection this might be because this version references `IEquatable` from `mscorlib`, but MS references it from `System.Runtime`
- differences in assembly attributes:
I think I don't have to care about them, they shouldn't affect the
functionality of TDF

This request also contains two changes that fix types outside of TPL Dataflow:
- d7f2593b19ae48919fa763eaab61b084ae13181c: new CancellationTokenRegistration().Dispose() shouldn't throw
- e8c29f0f1648a913e11f080c1dc1f21728fc873c: Check key for null in ConcurrentDictionary

I can put these two into separate pull requests, if required.