none
DateTime.ParseExact( ) Military Time Greater Then 13:00 Incorrectly Returning AM Time On One Machine

    Question

  • Hi,

    I'm wondering if anyone has any thoughts/suggestions here.

    We're using DateTime.ParseExact( ) with InvariantCulture parameter.

    Today on one machine in our farm, after a nightly reboot, started incorrectly processing times like 13:00 as 1:00AM instead of 1:00PM.

    We rebooted the machine and it worked normally after that.

    We took a memory dump with DebugDiag before the reboot.

    I'm wondering if anyone has seen this maybe and has any thoughts on cause.

    I'm wondering if it's possible to determine thread culture info from memory dump?

    Thanks in advance.

    Saturday, June 18, 2011 2:17 AM

Answers

  • Hi,

    Just sharing ...

    We ran into the problem again.

    We opend a ticket with MS and got some folks from language and globalization team to take a look at our memory dump.

    They confirmed PMDesignator was empty and that it should not be empty really.

    They mentioned a couple things.

    1) A potential code change to try - see if AM or PM designator is empty and if yes reset culture info.

    2) A Windows 2003 hot-fix to try - http://support.microsoft.com/default.aspx?scid=kb;en-US;2404988

    We went ahead and implemented both, just to be safe.

    In particular we log if the AM or PM designator is empty just to see if that comes up again. Once confirmed we don't see the issue for awhile we'll remove the code change portion.

    Thanks.

    (We're also moving to Win 2008 in near/distant future).


    • Marked as answer by Paul Zhou Monday, June 27, 2011 2:17 AM
    Saturday, June 25, 2011 2:05 AM

All replies

  •  

    Hi gpfa,

     

    Welcome to the MSDN forum.

     

    About how to read memory dump files that windows creates for debugging, you can refer to:

    How to read the small memory dump files that Windows creates for debugging

     

    Moreover, it is simply to debug your application using VS IDE. Set break point in your code, then debug it, stop at the DateTime.ParseExact() line and watch the value of InvariantCulture.

     

    More information:

    CultureInfo.InvariantCulture Property

     

    Sincerely,


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 20, 2011 7:14 AM
  • I wanted to see if anyone has seen this type of issue before.

    I'm hoping to find root cause so it can be prevented in the future.

    Any help there is appreciated =)

    Monday, June 20, 2011 5:11 PM
  • I was able to go thru the memory dump with WinDbg.

    I used !dumpheap -stat, then used !dumpheap -mt [object type], then used !do [object address]

    I found the CultureInfo and has culture ID = 127 (aka Invariant Culture)

    I also found for System.Globalization.DateTimeFormatInfo the AMDesignator has "AM" but the PMDesignator is empty.

    This seems interesting ...



    Monday, June 20, 2011 6:56 PM
  •  

    Hi,

     

    Thank you for your feedback.

     

    I haven't seen similar issue as yours. It is a little strange. May I ask you provide some code snippet how you use DateTime.ParseExact method? Did you use any custom datetime format strings? And where did you show the result, in a file or just on the screen in a textbox etc?


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 21, 2011 6:35 AM
  • Hi,

    Just sharing ...

    We ran into the problem again.

    We opend a ticket with MS and got some folks from language and globalization team to take a look at our memory dump.

    They confirmed PMDesignator was empty and that it should not be empty really.

    They mentioned a couple things.

    1) A potential code change to try - see if AM or PM designator is empty and if yes reset culture info.

    2) A Windows 2003 hot-fix to try - http://support.microsoft.com/default.aspx?scid=kb;en-US;2404988

    We went ahead and implemented both, just to be safe.

    In particular we log if the AM or PM designator is empty just to see if that comes up again. Once confirmed we don't see the issue for awhile we'll remove the code change portion.

    Thanks.

    (We're also moving to Win 2008 in near/distant future).


    • Marked as answer by Paul Zhou Monday, June 27, 2011 2:17 AM
    Saturday, June 25, 2011 2:05 AM
  •  

    Thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions.

     

    Sincerely,


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 27, 2011 2:17 AM