Skip to content

[BUG] Error when deserializing sessionId in JSON #38040

Open

Description

Library name and version

Azure.Analytics.Synapse.Artifacts 1.0.0-preview.18

Describe the bug

The SessionId property is mapped as int64 but the API is returning it as string.
image
image

Expected behavior

The property type matches the API response, and the deserialization works.

Actual behavior

An exception is raised.
System.InvalidOperationException: 'The requested operation requires an element of type 'Number', but the target element has type 'String'.'

Reproduction Steps

var r = await notebookRunClient.GetSnapshotAsync("7942e5c5-e9f1-42b6-88cd-c59a6afa2f4a");
var r2 = await notebookRunClient.GetStatusAsync("7942e5c5-e9f1-42b6-88cd-c59a6afa2f4a");

I created a custom HttpPipelinePolicy to workaround the problem:

    public override async ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline)
    {
        await ProcessNextAsync(message, pipeline);

        var json = await JsonSerializer.DeserializeAsync<JsonObject>(using message.Response.ContentStream);
        json["result"]["sessionId"] = long.Parse(json["result"]["sessionId"].GetValue<string>());

        var memoryStream = new MemoryStream();

        await JsonSerializer.SerializeAsync(memoryStream, json);
        memoryStream.Position = 0;
        message.Response.ContentStream = memoryStream;
    }

Environment

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.Synapsecustomer-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