[BUG] Error when deserializing sessionId in JSON
See original GitHub issueLibrary 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.
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
Issue Analytics
- State:
- Created 2 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Using HTTP or REST API as source in Copy Activity
My REST API call requires I pass a sessionId in the header. ... Error occurred when deserializing source JSON file '../applications'.
Read more >Net Core 3.0 TimeSpan deserialization error - Fixed in . ...
To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type...
Read more >webservices - Getting error while deserialize
A common cause is that the server is responding with a HTML page that contains error information rather than the JSON.
Read more >Solved: Cannot deserialize the current JSON array
Cannot deserialize the current JSON array. I'm getting an error when I try to convert csv to json. I've tried many different ways....
Read more >How to use sessions
By default, Django serializes session data using JSON. You can use the SESSION_SERIALIZER setting to customize the session serialization format.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the report, @kevinzz6 will help fix, thanks.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @wonner @yanjungao718 @annelo-msft.