Skip to content

Fix InvalidOperationException in pagination when services return relative nextLink URIs#56249

Merged
JoshLove-msft merged 3 commits intotypespec/update-http-client-1.0.0-alpha.20260212.5from
copilot/sub-pr-56248
Feb 13, 2026
Merged

Fix InvalidOperationException in pagination when services return relative nextLink URIs#56249
JoshLove-msft merged 3 commits intotypespec/update-http-client-1.0.0-alpha.20260212.5from
copilot/sub-pr-56248

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 13, 2026

Description

The TypeSpec generator update to support relative nextLink URIs (via UriKind.RelativeOrAbsolute) introduced a bug where accessing nextPage.AbsoluteUri throws InvalidOperationException when the URI is relative.

Changes:

  • Generator: Updated AzureCollectionResultDefinition.cs to generate a ternary check before accessing URI properties:

    nextPage?.IsAbsoluteUri == true ? nextPage.AbsoluteUri : nextPage?.OriginalString

    This preserves AbsoluteUri for absolute URIs (backward compatible) and safely handles relative URIs via OriginalString.

  • Test fixtures: Updated 12 NextLink test data files to reflect the new generated code pattern.

  • Generated code: Regenerated Basic-TypeSpec test project collection result files (16 files) to apply the fix.

All 186 Azure.Generator tests pass, including 14 NextLink-specific tests.


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code.
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
using System.ClientModel.Primitives;

namespace Server.Path.Single
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot revert all changes under Spector and package-lock.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in commit 7663622. All Spector test project changes and package-lock.json modifications have been removed.

Copilot AI changed the title [WIP] Update UnbrandedGeneratorVersion to 1.0.0-alpha.20260212.5 Fix InvalidOperationException in pagination when services return relative nextLink URIs Feb 13, 2026
Copilot AI requested a review from JoshLove-msft February 13, 2026 03:15
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
@JoshLove-msft JoshLove-msft marked this pull request as ready for review February 13, 2026 03:22
@JoshLove-msft JoshLove-msft merged commit 59e3459 into typespec/update-http-client-1.0.0-alpha.20260212.5 Feb 13, 2026
8 checks passed
@JoshLove-msft JoshLove-msft deleted the copilot/sub-pr-56248 branch February 13, 2026 03:23
JoshLove-msft added a commit that referenced this pull request Feb 13, 2026
* Update UnbrandedGeneratorVersion to 1.0.0-alpha.20260212.5

* Fix InvalidOperationException in pagination when services return relative nextLink URIs (#56249)

* Initial plan

* Fix relative URI handling in pagination - use IsAbsoluteUri check

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>

* Revert Spector and package-lock.json changes

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>

---------

Co-authored-by: Ubuntu <cloudtest@ff2ffbe4c000001.tkkhlgj2u51eln3mcb0lygmbye.dx.internal.cloudapp.net>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
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.

2 participants