H
Harshit_S_a
Guest
I have an old and heavy windows application where DateTime.TryParse(string value, out result) is used extensively.
Below code runs smoothly on Windows 7 and Windows 10.
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-AU"); // this is done when application starts
// Below is just an example or one of the way we have been using it. Here success is true and result is-> 20/02/2020 12:00:00 AM
var success = DateTime.TryParse("20 02", out result);
But above statement returns false when executed on Windows Server 2012 R2 Standard.
Appears like Win Server 2012 has broken the DateTime.TryParse. Interestingly if I use .netFrameork 3.5 then it works in all OS. But we are on framework v4.6.2 (VS-2019).
Is this a bug in Microsoft OS or .netFramework 4.6 ? Is there any existing workaround for this without making much changes in code, may be a .net framework patch etc. Honestly it will be difficult for me to make any changes in code related to this as its usage is more 10,000 in application.
Thanks in advance !!!
Continue reading...
Below code runs smoothly on Windows 7 and Windows 10.
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-AU"); // this is done when application starts
// Below is just an example or one of the way we have been using it. Here success is true and result is-> 20/02/2020 12:00:00 AM
var success = DateTime.TryParse("20 02", out result);
But above statement returns false when executed on Windows Server 2012 R2 Standard.
Appears like Win Server 2012 has broken the DateTime.TryParse. Interestingly if I use .netFrameork 3.5 then it works in all OS. But we are on framework v4.6.2 (VS-2019).
Is this a bug in Microsoft OS or .netFramework 4.6 ? Is there any existing workaround for this without making much changes in code, may be a .net framework patch etc. Honestly it will be difficult for me to make any changes in code related to this as its usage is more 10,000 in application.
Thanks in advance !!!
Continue reading...