locked
about LegacyAspNetSynchronizationContext and async RRS feed

  • Question

  • public async Task<ActionResult> TestModelBinder(CancellationToken cancellationToken) { await Task.Delay(1); var x = System.Web.HttpContext.Current; return Content("test"); }

    this is one of action in my controller,ang when the SynchronizationContext.Current type is

    LegacyAspNetSynchronizationContext,the variable x will be null!but when

    the SynchronizationContext.Current type is AspNetSynchronizationContext,the variable x will

    not be null. I want to know what is the cause of it.thanks.


    • Moved by CoolDadTx Wednesday, December 20, 2017 6:11 PM ASP.NET related
    Wednesday, December 20, 2017 3:00 PM

All replies

  • Please post questions related to ASP.NET in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, December 20, 2017 6:11 PM
  • OK.Thank you
    Thursday, December 21, 2017 2:39 AM