* DateTime.cs (DoParse): patch from Tom Philpot, while using
TryParse if s is null, we should return false, not crash.
svn path=/trunk/mcs/; revision=152708
+2010-03-01 Miguel de Icaza <miguel@novell.com>
+
+ * DateTime.cs (DoParse): patch from Tom Philpot, while using
+ TryParse if s is null, we should return false, not crash.
+
2010-02-28 Rodrigo Kumpera <rkumpera@novell.com>
* Type.cs: Forgot a pair of #if NET_4_0.
if (format == null)
return false;
+ if (s == null)
+ return false;
+
if ((style & DateTimeStyles.AllowLeadingWhite) != 0) {
format = format.TrimStart (null);
// bug #444103.
DateTime.ParseExact ("12:00:00", "HH:mm:ss.FFFFFFF", null);
}
+
+ [Test]
+ public void TryParseExact_NullString ()
+ {
+ DateTime dt;
+ DateTime.TryParseExact(null, "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'", CultureInfo.InvariantCulture,
+ DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out dt);
+ Assert.AreEqual(default(DateTime), dt);
+ }
#endif
}
}