Skip to content

Base64 decoding issue #115828

Closed
Closed
@Julien-Marpault

Description

@Julien-Marpault

Description

There's two different behavior when using Convert.FromBase64String() and Convert.TryFromBase64String()

Reproduction Steps

bool isValid = Base64.IsValid("EOCEGnkuGnWbveAi4iYqwzFVwe+nd6bSQv1TzL+IW0u/dg=="); // true
byte[] bytes =   Convert.FromBase64String("EOCEGnkuGnWbveAi4iYqwzFVwe+nd6bSQv1TzL+IW0u/dg==") // returns byte[]
bool isValid = Convert.TryFromBase64String("EOCEGnkuGnWbveAi4iYqwzFVwe+nd6bSQv1TzL+IW0u/dg==", [], out _) // false

Why ?

Expected behavior

Consitent output. Is it valid or not ?

Actual behavior

Inconsistent output

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.RuntimequestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions