ApplicationData.Current.LocalSettings and DateTimeOffset.MinValue
Hong
1,216
Reputation points
ApplicationDataContainer localSettings = ApplicationData.Current?.LocalSettings;
localSettings.Values["foo"] = DateTimeOffset.MinValue;
DateTimeOffset dto = (DateTimeOffset)localSettings.Values["foo"];
The last line of the above code throws the following exception
"Specified argument was out of the range of valid values."
at System.DateTime.ToLocalTime(Boolean throwOnOverflow)
at System.DateTimeOffset.ToLocalTime(Boolean throwOnOverflow)
at System.StubHelpers.DateTimeOffsetMarshaler.ConvertToManaged(DateTimeOffset& managedLocalDTO, DateTimeNative& nativeTicks)
at System.Runtime.InteropServices.WindowsRuntime.IReference`1.get_Value()
at System.Runtime.InteropServices.WindowsRuntime.CLRIReferenceImpl`1.UnboxHelper(Object wrapper)
at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, Int32 flags)
at System.Runtime.InteropServices.WindowsRuntime.IMap`2.Lookup(K key)
at System.Runtime.InteropServices.WindowsRuntime.MapToDictionaryAdapter.Lookup[K,V](IMap`2 _this, K key)
What is the range of valid values?
Sign in to answer