[Mono-dev] System.Net and SynchronizationContext

Federico Di Gregorio fog at dndg.it
Fri Mar 6 11:13:17 UTC 2015


Hi *,

I have discovered that the Mono implementation of WebClient doesn't 
behave as described in this MSDN article:

https://msdn.microsoft.com/en-us/magazine/gg598924.aspx

Specifically all Async methods don't capure the current 
SynchronizationContext to later run the event handlers on it.

I can probably provide some patches but I don't know if there are plans 
to replace that code with the one MS open sourced.

As a side note, inspecting the code I found that in quite a lot of 
places Mono doesn't implement the "event handler" pattern correctly doing:

if (Event != null)
     Event(args);

instead of:

var e = Event;
if (e != null)
     e(args);

Are patches about this welcome?

federico

  --
Federico Di Gregorio                         federico.digregorio at dndg.it
Di Nunzio & Di Gregorio srl                               http://dndg.it
                       The number of the beast: vi vi vi. -- Delexa Jones


More information about the Mono-devel-list mailing list