From 16d1821595fcf61668f4d7d44b21ad075ddba968 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 9 Sep 2020 18:00:04 +0000 Subject: [PATCH] Update AutoRest C# version to https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200909.1/autorest-csharp-v3-3.0.0-dev.20200909.1.tgz --- eng/CodeGeneration.targets | 3 ++- .../src/Shared/AutoRest/PageableHelpers.cs | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/eng/CodeGeneration.targets b/eng/CodeGeneration.targets index a406364a84bfd..2423c7250767f 100644 --- a/eng/CodeGeneration.targets +++ b/eng/CodeGeneration.targets @@ -3,7 +3,7 @@ <_AutoRestVersion>https://github.com/Azure/autorest/releases/download/autorest-3.0.6236/autorest-3.0.6236.tgz <_AutoRestCoreVersion>3.0.6306 - <_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200826.1/autorest-csharp-v3-3.0.0-dev.20200826.1.tgz + <_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200909.1/autorest-csharp-v3-3.0.0-dev.20200909.1.tgz <_SupportsCodeGeneration Condition="'$(IsClientLibrary)' == 'true'">true <_DefaultInputName Condition="Exists('$(MSBuildProjectDirectory)/autorest.md')">$(MSBuildProjectDirectory)/autorest.md $(_DefaultInputName) @@ -59,3 +59,4 @@ + diff --git a/sdk/core/Azure.Core/src/Shared/AutoRest/PageableHelpers.cs b/sdk/core/Azure.Core/src/Shared/AutoRest/PageableHelpers.cs index b890083765c96..a0ea80ba24d28 100644 --- a/sdk/core/Azure.Core/src/Shared/AutoRest/PageableHelpers.cs +++ b/sdk/core/Azure.Core/src/Shared/AutoRest/PageableHelpers.cs @@ -43,7 +43,13 @@ public FuncAsyncPageable(AsyncPageFunc firstPageFunc, AsyncPageFunc? nextP public override async IAsyncEnumerable> AsPages(string? continuationToken = default, int? pageSizeHint = default) { - AsyncPageFunc? pageFunc = _firstPageFunc; + AsyncPageFunc? pageFunc = string.IsNullOrEmpty(continuationToken) ? _firstPageFunc : _nextPageFunc; + + if (pageFunc == null) + { + yield break; + } + int? pageSize = pageSizeHint ?? _defaultPageSize; do { @@ -70,7 +76,13 @@ public FuncPageable(PageFunc firstPageFunc, PageFunc? nextPageFunc, int? d public override IEnumerable> AsPages(string? continuationToken = default, int? pageSizeHint = default) { - PageFunc? pageFunc = _firstPageFunc; + PageFunc? pageFunc = string.IsNullOrEmpty(continuationToken) ? _firstPageFunc : _nextPageFunc; + + if (pageFunc == null) + { + yield break; + } + int? pageSize = pageSizeHint ?? _defaultPageSize; do {