BOTS Framework, Null properties cannot be encrypted

124 views Asked by At

All of sudden my BOT started failing with this exception today:

Null properties cannot be encrypted. Please assign a default value to the property if you wish to encrypt it.

The error happens when trying to set conversation data and this is the stack trace:

    at Microsoft.Bot.Connector.ErrorHandling.<HandleErrorAsync>d__2`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Connector.BotStateExtensions.<SetConversationDataAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.ConnectorStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-SaveAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<Save>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-FlushAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase`1.<FlushAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.DialogTaskManagerBotDataLoader.<FlushAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Internals.LogPostToBot.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Conversation.<SendAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Bot.Builder.Dialogs.Conversation.<SendAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    at TransAlta.Trading.Bot.Controllers.MessagesController.<Post>d__0.MoveNext() in C:\Users\acodallo\Documents\Bots\TradingBot\TradingBot\Controllers\MessagesController.cs:line 28

Since I didn't change the code and I used it this morning no problem, I'm not too sure what could be happening. Any help would be appreciated.

UPDATE:

1) I don't see this error when using the emulator nor the test web chat client on dev.botframework.com, only when using Teams 2) Most the logic lives in my LUIS dialog and other specific dialogs that get kicked off depending on the intent:

[LuisIntent("Power.Buy")]
public async Task PowerTrade(IDialogContext context, IAwaitable<IMessageActivity>activity, LuisResult result)
{            
  BaseTrade formState = BaseTrade.InitState(result);
  formState.PositionType = PositionType.Buy;           

  SetCommonFields(formState);

  var tradeFormDialog = new FormDialog<BaseTrade>(formState, _tradeCreationDelegate, FormOptions.PromptInStart);            
  context.Call(tradeFormDialog, TradeTypeSpecificsDialog);
}

The BaseTrade Model:

public enum PositionType
{
    Buy, Sell, Swap              
}

public enum Unit
{
    Mw,
    Mwh,
    Gj,
    Mmbtu
}
public enum Timezone
{
    APT = 1,
    AST,
    CPT,
    CST,
    EPT,
    EST,
    GMT,
    MPT,
    MST,
    PPT,
    PST
}

[Serializable]
public class BaseTrade
{

    [Prompt("Position Type?")]
    public PositionType? PositionType;

    [Prompt("Who is the counterparty?")]
    public string Counterparty;         

    [Prompt("Start date?")]
    public DateTime StartDate;

    [Prompt("End date?")]
    public DateTime EndDate;

    public Timezone Timezone;

    [Prompt("Please enter the trade quantity")]
    public int? Quantity;

    public Unit? Unit;

    [Prompt("Price?")]
    public int? Price;

    public DateTime? TradeDate = new DateTime();

    public static IForm<BaseTrade> BuildForm()
    {
        return new FormBuilder<BaseTrade>().Message("OK, we are going to create a trade").Build();
    }
1

There are 1 answers

0
northern_poodle On BEST ANSWER

It turned out to be a problem on the Microsoft side.