Wednesday, April 17, 2019

how to fix DateTime.parseExact exception in Windows Server 2019?

when I deployed the ETL that use the exact date format like MM/dd/yyyy to load the date from configuration setting section.

i got the following error from the application log

Application: DealerETL.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.FormatException
   at System.DateTime.ParseExact(System.String, System.String, System.IFormatProvider)
   at DealerETL.SciAzure.Utilities.DaxHelper..cctor()

Exception Info: System.TypeInitializationException
   at DealerETL.SciAzure.Utilities.DaxHelper.rangeOfDealers()
   at DealerETL.SciAzure.DealerService+<UpdateDealer>d__1.MoveNext()

Exception Info: System.AggregateException
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean)
   at System.Threading.Tasks.Task.Wait(Int32, System.Threading.CancellationToken)
   at DealerETL.Program.Main(System.String[])


it is working fine to "MM/dd/yyyy" in the local development.. however the exception will be thrown if we did not change it to "MM'/'dd'/'yyyy".




No comments:

Post a Comment