microsoft / microsoft/teams.net

SignIn VerifyState activity state may be json objects on android and ios devices

Open
#302 2 comments 1 reaction 2 assignees Claimed by @singhk97 View on GitHub
bug
Dominant language
C#
Stars
46
Forks
21
Avg merge
22h 25m
Merged PRs (30d)
16

Description

Please refer to https://github.com/OfficeDev/microsoft-teams-library-js/issues/2189, https://github.com/OfficeDev/microsoft-teams-library-js/issues/528. The `state` property may not be string type, so it can cause json deserialization error when user signin on android and ios devices.

```
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.value.state | LineNumber: 0 | BytePositionInLine: 1123.
[ERROR] ---> System.InvalidOperationException: Cannot get the value of a token type 'StartObject' as a string.
[ERROR] at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
[ERROR] at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
[ERROR] at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[ERROR] at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
[ERROR] at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
[ERROR] --- End of inner exception stack trace ---
[ERROR] at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
[ERROR] at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
[ERROR] at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
[ERROR] at Microsoft.Teams.Api.Activities.Invokes.SignInActivity.JsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
[ERROR] at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
[ERROR] at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
[ERROR] at Microsoft.Teams.Api.Activities.InvokeActivity.JsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
[ERROR] at System.Text.Json.JsonSerializer.ReadFromNode[TValue](JsonNode node, JsonTypeInfo`1 jsonTypeInfo)
[ERROR] at Microsoft.Teams.Api.Activities.Activity.JsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[ERROR] at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
[ERROR] at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
[ERROR] at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
[ERROR] at Microsoft.Teams.Plugins.AspNetCore.AspNetCorePlugin.ParseActivity(HttpRequest httpRequest)
[ERROR] at Microsoft.Teams.Plugins.AspNetCore.AspNetCorePlugin.Do(HttpContext httpContext, CancellationToken cancellationToken)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.