Calling TimeZoneInfo.Local.DaylightName after changing the system time zone, while the app is open, does not get the updated system time zone. The attached sample app will showcase.
Steps to reproduce:
1. Launch app (on device, not simulator)
2. Click the + button
3. Note the console print statement (prints the time zone information)
4. Leave the app open, go to settings
5. Change the time zone information
6. Return to the app
7. Click the + button
The new time zone is printed
The time zone the system was set to when the app was launched is printed
EDIT: Apparently I can't attach the test project because it's too large. All the test app is doing is `Console.WriteLine(TimeZoneInfo.Local.DaylightName);` when you hit a button. Should be easy enough to reproduce.
First, can you please provide the information of you environment?
Easiest way to get exact version information:
- On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
- On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.
Then copy/paste the version information (you can use the "Copy Information" button).
Also, it might be the case that the test app that you are trying to attach has the binaries in it and therefore is to large. Please try reattaching the application deleting the binaries (clean in Visual Studio or delete the bin and obj folders).
Created attachment 24682 [details]
Ok, I got the test app attached. Below is my version information:
=== Visual Studio Community 2017 for Mac ===
Version 7.1 (build 1297)
Installation UUID: 64e410ba-8ab8-4492-adc6-fa7610f61deb
Mono 126.96.36.199 (d15-3/da80840) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 502000215
=== NuGet ===
=== .NET Core ===
Runtime: Not installed
SDK: Not installed
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 8.3.3 (12175.1)
=== Xamarin.Mac ===
Version: 188.8.131.52 (Visual Studio Community)
=== Xamarin.Android ===
Version: 184.108.40.206 (Visual Studio Community)
Android SDK: /Users/benfrye/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
SDK Tools Version: 25.2.5
SDK Platform Tools Version: 26
SDK Build Tools Version: 25.0.1
Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Android Designer EPL code available here:
=== Xamarin.iOS ===
Version: 10.12.0.20 (Visual Studio Community)
Build date: 2017-08-18 16:07:26-0400
=== Xamarin Inspector ===
Build date: Fri, 21 Apr 2017 17:57:12 GMT
=== Build Information ===
Release ID: 701001297
Git revision: 9c5299666538b2f8baf501418a5c064d784d64da
Build date: 2017-08-07 11:29:35-04
Xamarin addins: 3bb0c32a14f1b7e368bf5ac53a84c3581c019391
Build lane: monodevelop-lion-d15-3
=== Operating System ===
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
Thu Jun 15 17:36:27 PDT 2017
Thanks for the info. Will test the app with the current stable and the comping Xcode 9 branch.
This looks similar to bug 59596. In that bug, we are not getting the correct culture info, which, of course does affect the way the time zone info. Will be setting this bug as a duplicate of that bug, which is already in progress and being investigated.
*** This bug has been marked as a duplicate of bug 59596 ***
Manuel, I don't believe this is a duplicate of that bug. This bug has nothing to do with changing the device's culture nor region. This is when the time zone specifically is changed. As noted, closing and restarting the app acquires the correct info, so again it's not that it is ALWAYS getting the wrong info. It is merely if the time zone has been changed while the app is running. This is also not an iOS bug, as the bug 59596 seems to claim. This is only reproducible with Xamarin.iOS and not if you attempt to reproduce with a native iOS app.
I miss understood the bug. The issue is that the CultureInfo (for dates etc..) is not dynamically changed while the app is running after the settings have been changed. Is this correct?
Not the culture info, the TimeZoneInfo. `TimeZoneInfo.Local.DaylightName`
Ok, et me double check that.