Updates:
Summary: LocalDateTime.ToString() throws exception near end of time
Status: Accepted
Labels: Milestone-1.1-consider
Comment #2 on issue 215 by malcolm.rowe: LocalDateTime.ToString() throws
exception near end of time
http://code.google.com/p/noda-time/issues/detail?id=215
This does appear to be a regression against 1.0.x, probably because of
r7a65b5f5f560 (issue 197).
In fact, I think you can reproduce essentially the same problem with simply:
Console.WriteLine(Instant.MaxValue.InUtc());
Under 1.0.1, this produces:
Local: 01/01/31197 02:48:05 Offset: +00 Zone: UTC
Under 1.1.0, I get:
Unhandled Exception: System.ArgumentOutOfRangeException: Value should be in
range [-27255-31195]
Parameter name: year
31197
at NodaTime.Utility.Preconditions.CheckArgumentRange (System.String
paramName, Int32 value, Int32 minInclusive, Int32 maxInclusive) [0x00000]
in <filename unknown>:0
at NodaTime.Calendars.BasicCalendarSystem.GetYearTicks (Int32 year)
[0x00000] in <filename unknown>:0
at NodaTime.Calendars.GregorianCalendarSystem.GetYearTicks (Int32 year)
[0x00000] in <filename unknown>:0
at NodaTime.Calendars.BasicGJCalendarSystem.GetMonthOfYear (LocalInstant
localInstant, Int32 year) [0x00000] in <filename unknown>:0
at NodaTime.Calendars.BasicCalendarSystem.GetDayOfMonth (LocalInstant
localInstant) [0x00000] in <filename unknown>:0
at NodaTime.Fields.BasicDayOfMonthDateTimeField.GetValue (LocalInstant
localInstant) [0x00000] in <filename unknown>:0
at NodaTime.LocalDateTime.get_Day () [0x00000] in <filename unknown>:0
at NodaTime.Text.LocalDateTimePatternParser.<.cctor>b__b (LocalDateTime
value) [0x00000] in <filename unknown>:0
at (wrapper delegate-invoke) <Module>:invoke_int__this___LocalDateTime
(NodaTime.LocalDateTime)
at
NodaTime.Text.Patterns.DatePatternHelper+<>c__DisplayClass15`2+<>c__DisplayClass18[NodaTime.LocalDateTime,NodaTime.Text.LocalDateTimePatternParser+LocalDateTimeParseBucket].<CreateDayHandler>b__13
(LocalDateTime value, System.Text.StringBuilder sb) [0x00000] in <filename
unknown>:0
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at (wrapper delegate-invoke)
<Module>:invoke_void__this___LocalDateTime_StringBuilder
(NodaTime.LocalDateTime,System.Text.StringBuilder)
at
NodaTime.Text.Patterns.SteppedPatternBuilder`2+SteppedPattern[NodaTime.LocalDateTime,NodaTime.Text.LocalDateTimePatternParser+LocalDateTimeParseBucket].Format
(LocalDateTime value) [0x00000] in <filename unknown>:0
at
NodaTime.Text.Patterns.PatternBclSupport`1[NodaTime.LocalDateTime].Format
(LocalDateTime value, System.String patternText,
NodaTime.Globalization.NodaFormatInfo formatInfo) [0x00000] in <filename
unknown>:0
at NodaTime.LocalDateTime.ToString () [0x00000] in <filename unknown>:0
at System.String.Concat (System.Object[] args) [0x00039] in
/home/malcolm/noda-time/mono-2.10.9/mcs/class/corlib/System/String.cs:2134
at NodaTime.ZonedDateTime.ToString () [0x00000] in <filename unknown>:0
at System.IO.TextWriter.Write (System.Object value) [0x00006] in
/home/malcolm/noda-time/mono-2.10.9/mcs/class/corlib/System.IO/TextWriter.cs:163
at System.IO.TextWriter.WriteLine (System.Object value) [0x00000] in
/home/malcolm/noda-time/mono-2.10.9/mcs/class/corlib/System.IO/TextWriter.cs:273
at System.IO.SynchronizedWriter.WriteLine (System.Object value) [0x00008]
in
/home/malcolm/noda-time/mono-2.10.9/mcs/class/corlib/System.IO/TextWriter.cs:563
at System.Console.WriteLine (System.Object value) [0x00000] in
/home/malcolm/noda-time/mono-2.10.9/mcs/class/corlib/System/Console.cs:423
at Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Note that it appears to be the ToString() that causes this: simply
computing the LocalDateTime is fine.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings