goldytech/CSharpPerformanceBoosters

Test data assumes specific culture

JesHansen opened this issue · 0 comments

The test data assumes a culture that can parse DateTimes in the format '1/19/7051'. This is not universally the case. If you are located somewhere that uses another format for dates, you will get an exception when running the test:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.FormatException: String '4/20/2847' was not recognized as a valid DateTime.
   at System.DateTimeParse.Parse(ReadOnlySpan`1 s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.Convert.ToDateTime(String value)
   at FileIO.WithAsyncStreams.<>c.<ProcessStreamAsync>b__1_1(String[] employeeLine) in C:\src\CSharpPerformanceBoosters\src\FileIO\WithAsyncStreams.cs:line 38
   at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
   at System.Linq.Enumerable.SelectListIterator`2.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at FileIO.WithAsyncStreams.ProcessStreamAsync(String filePath) in C:\src\CSharpPerformanceBoosters\src\FileIO\WithAsyncStreams.cs:line 37
   at FileIO.Benchmarks.FileIOTest.AsyncStream() in C:\src\CSharpPerformanceBoosters\tests\FileIO.Benchmarks\FileIOTest.cs:line 48
   at BenchmarkDotNet.Autogenerated.Runnable_1.<.ctor>b__3_3() in C:\src\CSharpPerformanceBoosters\tests\FileIO.Benchmarks\bin\Release\net5.0\7ea90458-dc45-4102-9baf-2b1c22ea2ddc\7ea90458-dc45-4102-9baf-2b1c22ea2ddc.notcs:line 922
...