I have an MVC app where I override my base controller's OnActionExecuting()
method to set my thread culture:
protected override void OnActionExecuting(ActionExecutingContext filterContext) {
var langCode = GetLangCode();
Thread.CurrentThread.CurrentUICulture = new CultureInfo(langCode);
Thread.CurrentThread.CurrentCulture = new CultureInfo(langCode);
}
As I have started to program asynchronously more, I'm curious about how culture is persisted if we return the thread whose culture we've modified to the thread pool, and a new thread is dispatched when the async task completes? Any gotchas I should be aware of?