dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.28k stars 4.74k forks source link

Uri.TryCreate Returns True For Uris That Are Not Absolute - Linux #108221

Closed ashleyjlive closed 1 month ago

ashleyjlive commented 1 month ago

Description

After migrating our application tests from a Windows based build agent to a Linux based build agent we noticed that Uri.TryCreate has different behaviour. On Linux, Uri.TryCreate("/foo", UriKind.Absolute, out var uri) returns true whereas on Windows it returns false. I believe the behaviour on Linux is incorrect.

Reproduction Steps

Execute Uri.TryCreate("/foo", UriKind.Absolute, out var uri) on a Linux machine. Its output will be true whereas on Windows it is false.

Expected behavior

It should return false.

Actual behavior

It returns true.

Regression?

No response

Known Workarounds

No response

Configuration

Unix 6.5.0.1024

Other information

No response

dotnet-policy-service[bot] commented 1 month ago

Tagging subscribers to this area: @dotnet/ncl See info in area-owners.md if you want to be subscribed.

vcsjones commented 1 month ago

This is a duplicate of https://github.com/dotnet/runtime/issues/80118 and https://github.com/dotnet/runtime/issues/76816.

See those issues for an explanation of why this is expected behavior.

MihaZupan commented 1 month ago

Closing as (unfortunately) by design as per above info.