Tom Deseyn
Tom Deseyn

Reputation: 1895

ASP.NET Core 1.0 SynchronizationContext

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");
            }

Upvotes: 7

Views: 1112

Answers (1)

tugberk
tugberk

Reputation: 58444

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.

Upvotes: 13

Related Questions