When targeting .NET 4.6, CurrentThread.CultureInfo uses async-local storage to back the property. This now results in regressed and undesirable behavior in Workbooks, since each code cell is an async Task. Thus, setting CurrentThread.CultureInfo does not affect subsequent cells.
On Windows we can revert to thread-local storage for the CurrentThread.CultureInfo by setting the AppContext switch "Switch.System.Globalization.NoAsyncCurrentCulture" to true. On Mono however, this switch is simply ignored. As a result, both
System.Threading.CurrentThread.CultureInfo and System.Globalization.CultureInfo.CurrentCulture are unusable in Mac, iOS, and Android Workbooks.
Doing a little digging, we found that the .NET reference source for AppContextSwitches (the storage backing AppContext) was not actually taken into Mono when integrating other reference sources (e.g. System.Threading.Thread).
This is what AppContextSwitches should be (or some functional analogue):
But this is Mono's AppContextSwitches:
Thus `AppContext.SetSwitch ("Switch.System.Globalization.NoAsyncCurrentCulture", true)` is completely ignored, and the switch will always be false (async-local) instead of true (thread-local).
I'll try to make AppContextSwitches more usable.
PR against master: https://github.com/mono/mono/pull/4682
PR for relnotes: https://github.com/mono/website/pull/278
Closing, all changes have been merged
Hi @Aaron Bockover, Looks like development bug, will you please help me out to verify this?