Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core 1.0 SynchronizationContext

Tags:

asp.net-core

Is SynchronizationContext null in an ASP.NET Core 1.0 website? This code throws an exception on my system:

        app.Use(async (context, next) =>
        {
            var sc = System.Threading.SynchronizationContext.Current;
            if (sc == null)
            {
                throw new Exception("SynchronizationContext is null");
            }
like image 688
Tom Deseyn Avatar asked Jul 17 '15 08:07

Tom Deseyn


1 Answers

It is gone in ASP.NET 5 as you don't need its functionality. Its whole purpose was to flow HttpContext.Current which is gone.

I think it was also doing something with the current culture but I am not sure how that is handled now.

like image 174
tugberk Avatar answered Oct 17 '22 22:10

tugberk