我目前正在本地化Windows Phone應用程序,但我已經開始在DateTime.Now.ToString()上獲取一個超出範圍的異常索引。Windows Phone DateTime異常
我試過改變我的電腦的時區,但錯誤仍然存在。
我不確定是什麼導致了這個問題,或者怎麼解決它。
任何想法?提前致謝!
堆棧跟蹤(應要求加)
mscorlib.dll!System.Globalization.DateTimeFormatInfo.GetYearMonthPattern(int calID = 1) + 0x25 bytes
mscorlib.dll!System.Globalization.DateTimeFormatInfo.InitializeOverridableProperties() + 0x94 bytes
mscorlib.dll!System.Globalization.DateTimeFormatInfo.Calendar.set(System.Globalization.Calendar value = {System.Globalization.GregorianCalendar}) + 0x1a8 bytes
mscorlib.dll!System.Globalization.DateTimeFormatInfo.DateTimeFormatInfo(System.Globalization.CultureTableRecord cultureTable = {System.Globalization.CultureTableRecord}, System.Globalization.Calendar cal = {System.Globalization.GregorianCalendar}) + 0x29 bytes
mscorlib.dll!System.Globalization.CultureInfo.DateTimeFormat.get() + 0x19 bytes
mscorlib.dll!System.Globalization.CultureInfo.GetFormat(System.Type formatType = {Name = "DateTimeFormatInfo" FullName = "System.Globalization.DateTimeFormatInfo"}) + 0x22 bytes
mscorlib.dll!System.Globalization.DateTimeFormatInfo.CurrentInfo.get() + 0x2a bytes
mscorlib.dll!System.DateTime.ToString()
> QuickAirtime.dll!QuickAirtime.PaymentSummary.btnTransactionClick(object sender = {System.Windows.Controls.Button}, System.Windows.RoutedEventArgs e = {System.Windows.RoutedEventArgs}) Line 78 + 0x2 bytes C#
System.Windows.dll!System.Windows.Controls.Primitives.ButtonBase.OnClick() + 0x1f bytes
System.Windows.dll!System.Windows.Controls.Button.OnClick() + 0x1f bytes
System.Windows.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e = {System.Windows.Input.MouseButtonEventArgs}) + 0x4e bytes
System.Windows.dll!System.Windows.Controls.Control.OnMouseLeftButtonUp(System.Windows.Controls.Control ctrl = {System.Windows.Controls.Button}, System.EventArgs e = {System.Windows.Input.MouseButtonEventArgs}) + 0xc bytes
System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj = 227599168, System.IntPtr unmanagedObjArgs = 227256368, int argsTypeIndex = 169, int actualArgsTypeIndex = 169, string eventName = "[email protected]@4") + 0x115 bytes
[External Code]
你確定這個異常是由DateTime.Now.ToString()引發的嗎?這似乎不可能。 (請發佈異常堆棧跟蹤) –
@PhilippeLeybaert我已經編輯了問題以顯示StackTrace – user1477707
你能告訴我們導致異常的實際代碼行(以及它周圍的幾行代碼),所以我們有一個最小的例子重現錯誤?另外:你是否強迫一種仿真器/電話設備不支持的文化? –