Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

.NET 11 adds stricter validation to UriBuilder.Host that rejects values containing path separators. Test infrastructure in ServiceUtilHelper.BuildBaseUri was setting Host to values like "hostname/path", breaking CI/PR tests.

Changes

  • Split ServiceUri at first / when present, setting Host and Path properties separately
  • Preserve existing behavior for hostname-only ServiceUri values (local dev scenarios)
// Before
builder.Host = TestProperties.GetProperty(TestProperties.ServiceUri_PropertyName);

// After
string serviceUri = TestProperties.GetProperty(TestProperties.ServiceUri_PropertyName);
int pathSeparatorIndex = serviceUri.IndexOf('/');
if (pathSeparatorIndex >= 0)
{
    builder.Host = serviceUri.Substring(0, pathSeparatorIndex);
    builder.Path = serviceUri.Substring(pathSeparatorIndex);
}
else
{
    builder.Host = serviceUri;
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • d0svsblobprodcus381.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build src/System.Private.ServiceModel/tests/Common/Infrastructure/Infrastructure.Common.csproj --no-restore (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Changes in UriBuilder.Host validation breaking test infrastructure</issue_title>
<issue_description>In ServiceUtilHelper.BuildBaseUri, we do the following:

var builder = new UriBuilder();
builder.Host = TestProperties.GetProperty(TestProperties.ServiceUri_PropertyName);

In our PR and CI tests, the ServiceUri is of the format "hostname/path". Previously UriBuilder allowed you to set the Host property to the hostname which included the path. A recent change upcoming in .NET 11 added stricter validation to the Host property to disallow anything other than the hostname, which is causing WCF tests to fail.

The path is optional in ServiceUri as when running the tests on a local dev machine, the path would be the root (/), so ServiceUri only contains the hostname in that case.

We need to change the logic in BuildBaseUri so that if there is a path portion, ServiceUri is split into the host and the path, and set separately on the Host and Path properties of UriBuilder.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 21, 2026 03:15
Co-authored-by: mconnew <8648390+mconnew@users.noreply.github.com>
Co-authored-by: mconnew <8648390+mconnew@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix UriBuilder.Host validation in BuildBaseUri Split ServiceUri host and path for UriBuilder.Host validation Jan 21, 2026
Copilot AI requested a review from mconnew January 21, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changes in UriBuilder.Host validation breaking test infrastructure

2 participants