Skip to content

Uri.TryUnescapeDataString throws ArgumentOutOfRangeException #128608

Description

@GerardSmit

Description

When a specific string is provided to Uri.TryUnescapeDataString, it throws an exception

Reproduction Steps

Execute the following code:

using System;

Uri.TryUnescapeDataString("Prefix %20".AsSpan(), [], out _);

Sharplab

Expected behavior

No exception -> returns false

Actual behavior

Throws ArgumentOutOfRangeException

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

When you change the string that the escape is only at the beginning, it does NOT throw:

using System;

Uri.TryUnescapeDataString("%20suffix".AsSpan(), [], out _);

Sharplab

When you do both, it also throws:

using System;

Uri.TryUnescapeDataString("Prefix%20suffix".AsSpan(), [], out _);

Sharplab

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions