'GetAsync' throw 'System.Text.Json.JsonReaderException' while trying to read mails from mailbox folders #2877
Labels
status:waiting-for-triage
An issue that is yet to be reviewed or assigned
type:bug
A broken experience
Describe the bug
Hi,
Graph SDK: NuGet "Microsoft.Graph" Version="5.73.0"
C# (dotnet 8)
I`m getting 'System.Text.Json.JsonReaderException' exception.
This exception is not being thrown consistently.
This is a snipped code of the Graph SDK useage:
rGraphClient .Users[mUser.Id] .MailFolders[iFolder.Id] .Messages .GetAsync(iConfig => { iConfig.QueryParameters.Select = [ "from", "receivedDateTime", "createdDateTime", "subject", "id", "hasAttachments", "body", "attachments" ]; iConfig.QueryParameters.Expand = ["attachments"]; iConfig.QueryParameters.Filter = iFilter; iConfig.QueryParameters.Orderby = ["receivedDateTime DESC"]; iConfig.QueryParameters.Top = rOffice365Settings.MailsCountToRead; iConfig.Headers.Add("Prefer", $"outlook.body-content-type=\"{rOffice365Settings.PreferredContentType}\""); iConfig.Headers.Add("Accept-Language", rOffice365Settings.AcceptLanguage); }, cancellationToken: iCancellationToken).ConfigureAwait(false);
The mail box language is in Espanol (Costa Rica) so I tried to play with the settings but it did not helped.
When:
AcceptLanguage: en-US,
PreferredContentType: text,
mailsCountToReadPerIteration: 10
I got:
Error from System.Text.Json: System.Text.Json.JsonReaderException: 'e' is invalid after a value. Expected either ',', '}', or ']'. LineNumber: 0 | BytePositionInLine: 7464595. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan
1 bytes)at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)
at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
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.ParseAsyncCore(Stream utf8Json, JsonDocumentOptions options, CancellationToken cancellationToken)
at Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory.GetRootParseNodeAsync(String contentType, Stream content, CancellationToken cancellationToken)
at Microsoft.Kiota.Abstractions.Serialization.ParseNodeProxyFactory.GetRootParseNodeAsync(String contentType, Stream content, CancellationToken cancellationToken)
at Microsoft.Kiota.Abstractions.Serialization.ParseNodeFactoryRegistry.GetRootParseNodeAsync(String contentType, Stream content, CancellationToken cancellationToken)
at Microsoft.Kiota.Abstractions.Serialization.ParseNodeProxyFactory.GetRootParseNodeAsync(String contentType, Stream content, CancellationToken cancellationToken)
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.GetRootParseNodeAsync(HttpResponseMessage response, CancellationToken cancellationToken)
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory
1 factory, Dictionary
2 errorMapping, CancellationToken cancellationToken)at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory
1 factory, Dictionary
2 errorMapping, CancellationToken cancellationToken)at Microsoft.Graph.Users.Item.MailFolders.Item.Messages.MessagesRequestBuilder.GetAsync(Action
1 requestConfiguration, CancellationToken cancellationToken)
When:
AcceptLanguage: es-ES
PreferredContentType: text
MailsCountToRead: 10
I got:
Please advice how to continue.
Expected behavior
Enable to read emails
How to reproduce
I`m not sure but maybe set the mailbox language to Spanish
SDK Version
5.73.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: