Skip to content

DateTime.ParseExact throws exception with message missing original string #94907

Closed

Description

@azhmur

Description

If incorrect string passed to ParseExact, exception message misses original string and reports empty string instead.

Reproduction Steps

DateTime.ParseExact("XXXXX", "MM/dd/yyyy", CultureInfo.InvariantCulture);

Expected behavior

net7:
System.FormatException: String 'XXXXX' was not recognized as a valid DateTime.

Actual behavior

net8:
System.FormatException: String '' was not recognized as a valid DateTime.

Regression?

Yes. Works correctly in net7.

Known Workarounds

No response

Configuration

net8, windows-x64

Other information

No response

Activity

  1. ghost added
    needs-area-label
    on Nov 17, 2023
  2. ghost added
    untriaged
    on Nov 17, 2023
  3. vcsjones commented on Nov 17, 2023

    @vcsjones
    Member

    Closing as a duplicate of #94837.

  4. ghost removed
    untriaged
    on Nov 17, 2023
  5. tarekgh commented on Nov 17, 2023

    @tarekgh
    Member

    fixed by #91303

  6. added and removed
    needs-area-label
    on Nov 17, 2023
  7. added this to the 9.0.0 milestone on Nov 17, 2023
  8. locked and limited conversation to collaborators on Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions