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
Description
When a specific string is provided to Uri.TryUnescapeDataString, it throws an exception
Reproduction Steps
Execute the following code:
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:
Sharplab
When you do both, it also throws:
Sharplab