我在 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/