c# - DateTime.Now.Tostring() - 奇怪的结果

标签 c# datetime mono raspberry-pi raspbian

我在 Raspberry Pi 上使用 Mono(运行 Raspbmc)。大多数事情(令人惊奇!)都能正常工作,但是有一段代码表现得很奇怪。

使用csharp C#“shell”,我得到了这个(编译后的对应结果相同):

csharp> DateTime.Now.ToString();
"00/735023/0001 23:05:56"

csharp> DateTime.Now.ToString("dd"); //get day numeral
"735023"

csharp> DateTime.Now.ToString("MMMM"); //get month name
System.ArgumentOutOfRangeException: Argument is out of range.
  at System.Globalization.DateTimeFormatInfo.GetMonthName (Int32 month) 
  [...]

...但是,访问单独的属性是有效的:

csharp> DateTime.Now.Day.ToString();
"4"

csharp> DateTime.Now.Month.ToString();
"6"

csharp> DateTime.Now.Year.ToString();
"2013"

知道发生了什么,或者至少我应该在哪里提交错误吗?

FWIW:这就是我正在运行的

pi@raspbmc:~$ mono -V
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-5)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

最佳答案

报告了相关错误:https://bugzilla.xamarin.com/show_bug.cgi?id=7938 。原因:使用hardfp而不是softfp浮点ABI,与Mono 2.10不兼容。有一些补丁将支持 Mono 中的 Hardfp,但还没有成为主线。

关于c# - DateTime.Now.Tostring() - 奇怪的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16926634/

相关文章:

.net - 公开 IList<T> 或 ReadOnlyCollection<T> 作为只读属性?

c# - Mono 和 Microsoft .Net 程序集如何具有相同的公钥 token ?

c# - 遗留 16 位应用程序的 Kiosk 模式

java - 在 java 应用程序和 android 应用程序中使用相同的 java 类时的两种不同格式

php - MySQL:从日期时间列中计算连续工作日的数量

asp.net-mvc-3 - MVC3 中的大于或等于今天日期验证注释

asp.net - 将 ASP.NET 应用程序转换为 Mono,无需 .csproj 和 .sln

c# - 对从托管代码创建的事件的 WaitForSingleObject 访问被拒绝

c# - 直接在C#中设置property的属性

c# - 如何从键盘布局标识符中获取键盘布局名称?