Created
September 29, 2014 16:35
-
-
Save neuecc/4ceaa5a4ca3f8e915b43 to your computer and use it in GitHub Desktop.
AspNetSynchtonizationContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async Task Hoge() | |
{ | |
Debug.WriteLine(System.Web.HttpContext.Current == null); // false | |
await Task.Delay(TimeSpan.FromMilliseconds(100)).ConfigureAwait(false); // キャプチャしない | |
Debug.WriteLine(System.Web.HttpContext.Current == null); // true | |
} | |
public async Task<ActionResult> Index() | |
{ | |
Debug.WriteLine(System.Web.HttpContext.Current == null); // false | |
await Hoge(); // 生きてるHttpContextをキャプチャする | |
Debug.WriteLine(System.Web.HttpContext.Current == null); // false | |
return View(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment