Skip to content

StateClient Exception #1017

@wiltodelta

Description

@wiltodelta

My code:

            var stateClient = new StateClient(
                new Uri(loginSession.ServiceUrl),
                _microsoftAppId,
                _microsoftAppPassword);

            BotData userData = await stateClient.BotState.GetUserDataAsync(
                loginSession.ChannelId, loginSession.UserId);

            userData.SetProperty("AccessToken", tokenResponseModel.AccessToken);
            userData.SetProperty("UserId", tokenResponseModel.UserId);

            await stateClient.BotState.SetUserDataAsync(
                loginSession.ChannelId, loginSession.UserId, userData);

Exception:

[JsonReaderException: Unexpected character encountered while parsing value: T. Path '', line 0, position 0.]
Newtonsoft.Json.JsonTextReader.ParseValue() +1025
Newtonsoft.Json.JsonTextReader.Read() +103
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter) +74
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) +451
Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) +210
Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) +13
Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(String json, JsonSerializerSettings settings) +312
Microsoft.Bot.Connector.d__5.MoveNext() in C:\Projects\GitHub\BotBuilder-NuGet3.1.0\CSharp\Library\Microsoft.Bot.Connector\StateAPI\BotState.cs:186

I can't use IDialogContext to changing UserData, because code executing in different context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions