Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undocumented behavior changes of Uri.TryCreate between net6 and net8 #111262

Open
letientai299 opened this issue Jan 10, 2025 · 3 comments
Open
Labels
area-System.Net untriaged New issue has not been triaged by the area owner

Comments

@letientai299
Copy link
Member

Description

Uri.IsLoopback returns true for https://LOCALHOST in net6, but false in net8.

This should be documented as a net8 breaking change. I also check and found no related item in net7 breaking changes page.

Reproduction Steps

Create a simple console app project with this file structure

.
├── Loopback.6.csproj
├── Loopback.8.csproj
└── Program.cs

Content of Program.cs

using System;

const string s = "https://LOCALHOST";
Uri.TryCreate(s, UriKind.Absolute, out var u);
Console.WriteLine(u?.IsLoopback);

Content of Loopback.6.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
</Project>

Content of Loopback.8.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>
</Project>

Then, execute the program with each runtime

$ dotnet restore Loopback.8.csproj -v quiet && dotnet run --project Loopback.8.csproj --quiet
False

$ dotnet restore Loopback.6.csproj -v quiet && dotnet run --project Loopback.6.csproj --quiet
True

Expected behavior

N/A

Actual behavior

N/A

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 10, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 10, 2025
@MihaZupan MihaZupan added area-System.Net and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 10, 2025
Copy link
Contributor

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

@MihaZupan
Copy link
Member

This was an unintended regression in .NET 8.
It's been fixed in .NET 9: #105008.

@letientai299
Copy link
Member Author

I see. We have manually fixed it, but I think the docs should still be updated to inform those users who want to stay on LTS releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

2 participants