none
.NET 4.5 SynchronizationContext breaking change RRS feed

  • Question

  • At the breaking change notes for .NET 4.5 there is following entry for the SynchronizationContext.Current property. Quote:

    Change: In the .NET Framework 4.5, Windows Forms no longer overrides a null synchronization context.
    Impact: This change may break an application that assumes that the synchronization context is always non-null.

    Does anyone know details about this change? Making a new 4.5 WinForms app still sets the SynchronizationContext when a Control subclass constructor is called, so I'm clueless about what this "breaking change" means. I'm worried about this because we are using SynchronizationContext extensively and I need to evaluate the impact of running on .NET 4.5 (especially since its not an option to run on 4.0 if the end user has 4.5 installed).

    (I also posted this at the WinForms forum but couldn't get an answer there; since SynchronizationContext is also part of the BCL I'm trying here now. If this is not the appropriate place, where should I ask to get an answer?)
    Monday, August 20, 2012 8:00 AM

Answers

  • On the other thread an answer has been posted stating that this breaking change was reverted and never made it into the published .NET 4.5 version; it will be removed from the list from breaking changes.
    • Marked as answer by Tobias Käs Monday, August 27, 2012 8:16 PM
    Monday, August 27, 2012 8:16 PM

All replies

  • Hi Tobias,

    Thank you for posting on this forum.

    Please take a look at this thread: http://stackoverflow.com/questions/11621372/synchronizationcontext-current-is-null-in-continuation-on-the-main-ui-thread 

    It is a similar question about this issue. 

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, August 21, 2012 11:04 AM
    Moderator
  • Hi Mike,

    Actually it's not similar at all, it's the opposite: in your linked issue the SynchronizationContext was null in .NET 4.0 due to a bug, and it has been fixed in .NET 4.5 to properly flow the SynchronizationContext (so it is not null anymore).

    The "breaking change" for .NET 4.5 states the opposite, that there exists a scenario where previously a SynchronizationContext was available in .NET 4.0 but now will be null in .NET 4.5. Unfortunately it doesn't explain in which scenario this will happen.

    We need to know in which scenario this can happen so we can make sure that the null SynchronizationContext in 4.5 will be handled correctly where previously a SynchronizationContext used to be available.

    PS: The corresponding thread on the WinForms forum is here. By now someone posted he would forward the question (if I understood him correctly).

    Thank you for your time.
    Regards,
    Tobias Käs

    Tuesday, August 21, 2012 1:19 PM
  • On the other thread an answer has been posted stating that this breaking change was reverted and never made it into the published .NET 4.5 version; it will be removed from the list from breaking changes.
    • Marked as answer by Tobias Käs Monday, August 27, 2012 8:16 PM
    Monday, August 27, 2012 8:16 PM