Skip to content

[BUG] Maps Routing batch response being truncated #47707

Open
@patrickhacens

Description

@patrickhacens

Library name and version

Azure.Maps.Routing 1.0.0-beta.4

Describe the bug

Big responses returned through the GetRouteDirectionsBatchAsync method gets truncated

Expected behavior

The method to return data and be deserialized into Response<RouteDirectionsBatchResult>

Actual behavior

Exception being thrown

System.Text.Json.JsonReaderException: 'Expected depth to be zero at the end of the JSON payload. There is an open JSON object or array that should be closed. LineNumber: 0 | BytePositionInLine: 3123601.'

   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)
   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)
   at Azure.Maps.Routing.Models.GetDirectionsOperation.<WaitForCompletionAsync>d__19.MoveNext() in C:\Users\patri\source\repos\azure-sdk-for-net\sdk\maps\Azure.Maps.Routing\src\Models\Operation\GetDirectionsOperation.cs:line 103
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Azure.Maps.Routing.Models.GetDirectionsOperation.<WaitForCompletionAsync>d__15.MoveNext() in C:\Users\patri\source\repos\azure-sdk-for-net\sdk\maps\Azure.Maps.Routing\src\Models\Operation\GetDirectionsOperation.cs:line 74
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Azure.Maps.Routing.MapsRoutingClient.<GetDirectionsBatchAsync>d__26.MoveNext() in C:\Users\patri\source\repos\azure-sdk-for-net\sdk\maps\Azure.Maps.Routing\src\MapsRoutingClient.cs:line 905
...

JSON response being truncated

Reproduction Steps

using Azure;
using Azure.Core.GeoJson;
using Azure.Maps.Routing;

AzureKeyCredential credential = new AzureKeyCredential("<credentials>");
MapsRoutingClient routeClient = new(credential);

RouteDirectionOptions azureRouteOptions = new()
{
	TravelMode =  TravelMode.Truck,
	InstructionsType = RouteInstructionsType.Text,
	Language = RoutingLanguage.EnglishUsa,
	UseTrafficData = false,
};

GeoPosition origin = new(-88.3, 41.92);
List<GeoPosition> geoPositions = [
	new(-111.38, 47.65),
	new(-111.34, 47.26),
	new(-111.25, 47.48),
	new(-112.6, 47.58),
	new(-113.37, 48.78),
	new(-110.87, 47.26),
	new(-111.26, 47.53),
	new(-111.57, 48.02),
	new(-113.27, 48.59),
	new(-109.92, 46.8)
];

List<RouteDirectionQuery> queries = [];

foreach (var destination in geoPositions)
{
	queries.Add(new RouteDirectionQuery([
				new GeoPosition(origin.Longitude, origin.Latitude),
				new GeoPosition(destination.Longitude, destination.Latitude)],
				azureRouteOptions));
}


var response = routeClient.GetDirectionsBatch(WaitUntil.Completed, queries);

Environment

VS 17.10.3

.NET SDK:
Version: 8.0.302
Commit: ef14e02af8
Workload version: 8.0.300-manifests.5273bb1c
MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.302\

.NET workloads installed:
[maui-windows]
Installation Source: VS 17.10.35013.160
Manifest Version: 8.0.40/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.40\WorkloadManifest.json
Install Type: FileBased

[maccatalyst]
Installation Source: VS 17.10.35013.160
Manifest Version: 17.2.8053/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.2.8053\WorkloadManifest.json
Install Type: FileBased

[ios]
Installation Source: VS 17.10.35013.160
Manifest Version: 17.2.8053/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.2.8053\WorkloadManifest.json
Install Type: FileBased

[android]
Installation Source: VS 17.10.35013.160
Manifest Version: 34.0.95/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.95\WorkloadManifest.json
Install Type: FileBased

[wasm-tools-net6]
Installation Source: VS 17.10.35013.160
Manifest Version: 8.0.5/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.net6\8.0.5\WorkloadManifest.json
Install Type: FileBased

[wasm-tools]
Installation Source: VS 17.10.35013.160
Manifest Version: 8.0.5/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.current\8.0.5\WorkloadManifest.json
Install Type: FileBased

[aspire]
Installation Source: VS 17.10.35013.160
Manifest Version: 8.0.0/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json
Install Type: FileBased

Host:
Version: 8.0.6
Architecture: x64
Commit: 3b8b000a0e

.NET SDKs installed:
8.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
C:\Users\patri\source\repos\azure-sdk-for-net\global.json

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.MapsService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions