Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
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?