Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
DateTime.Parse/TryParse fails if the date and time uses the same separator #1322
The following code (in .NET 4.6) throws a FormatException:
Windows 10 for some reason changed the time separator for some locales (norwegian, finnish and serbian) which now breaks with Parse and TryParse.
edit: missed the format on the parse.
This is known issue and not a new one. the parser is just thinking it is parsing a time (and not a date) and then decide it is not valid time. in general the Parse/TryParse is not guaranteeing the parse all possible strings and we always recommend to use ParseExact/TryParseExact to guarantee successful parsing.
referenced this issue
Aug 20, 2015
Regarding the same issue in .NET Framework, see my blog post at http://www.heikniemi.net/hardcoded/2015/08/windows-10-breaks-net-date-parsing-in-certain-locales/. And now that the state machine has been fixed there, I hope the fix will flow down here as well :-)