title: Botframework - C# - Adaptive Card - Submit Action - Exception
body: <p>On SubmitAction action in Adaptive Cards (botframework, c#, emulator, localhost) I get this Exception</p>
  
  <pre><code>Exception: Value cannot be null. Parameter name: stringToEscape
  [File of type 'text/plain']
  </code></pre>
  
  <p>Can you help me point out what am doing wrong?                             </p>
  
  <pre><code>card.Actions.Add(
      new SubmitAction()
      {
          Title = "Submit"
          Data = Newtonsoft.Json.Linq.JObject.FromObject(new { button = "Submit", ServerUrl = "idServerURL" })
      }
  );
  </code></pre>
  
  <p>From RootDialog - LUIS Intent is called</p>
  
  <pre><code>[LuisIntent("ServerAuth")]
  public async Task ServerAuthIntentActionResultHandlerAsync(IDialogContext 
  context, IAwaitable&lt;IMessageActivity&gt; activity, LuisResult result)
  {
      var message = await activity;
      await context.PostAsync($"Am working on it...'{message.Text}' ");
  
      var serverAuthAction = new ServerAuthAction();
  
      // Action to execute if no form is required - Based on LUIS result, call fulfillment methods From/To ERP Data and proceed to next stage of dialog
      await serverAuthAction.ResumeActionServerAuthFormDialog(context, result);
  
      //context.Wait(this.MessageReceived);
  
  }
  
  public async Task ResumeActionServerAuthFormDialog(IDialogContext context, LuisResult result)
  {
      try
      {
          //Based on the LUIS Result, fetch data from AppServer
          //var searchQuery =  result;
  
          //Data - Assign value to this Model from AppServer fetched data
          ServerAuthModel serverAuthData = new ServerAuthModel();
          serverAuthData = default(ServerAuthModel);
  
          //For testing populate values by hardcoding - /May/2017
          ServerAuthAdaptiveCardView serverAuthView = new ServerAuthAdaptiveCardView();
  
          //Pass Data to Channel Adaptive Card View 
          var resultData = serverAuthView.GetServerAuthAdaptiveCard();
  
          var resultMessage = context.MakeMessage();
  
          resultMessage.Attachments.Add(resultData);
  
          await context.PostAsync(resultMessage);
      }
      catch (Exception ex)
      {
          ...
      }
      finally
      {
          ....
      }
  }
  </code></pre>
  
  <p>GetServerAuthAdaptiveCard() has the Submit Action code.</p>
  
  <pre><code>public Attachment GetServerAuthAdaptiveCard()
  {
      AdaptiveCard card = new AdaptiveCard();
      card.FallbackText = "App Server Authentication";
      card.Body.Add(
          new TextInput()
          {
              Id = "idServerURL",
              IsRequired = true,
              Placeholder = "App Server URL",
              MaxLength = 100,
              IsMultiline = false,
              Style = TextInputStyle.Url,
              Speak = "App Server URL",
          });
  
      card.Body.Add(
          new ChoiceSet()
          {
              Id = "idAuthCompany",
              IsRequired = true,
              IsMultiSelect = false,
              Style = ChoiceInputStyle.Compact,
              Speak = "Company to Authenticate for",
              Value = "DocM5",
              Choices = new List&lt;Choice&gt;() {
                  new Choice()
                  {
                      Title = "P2PDemo",
                      Value = "P2PDemo",
                      IsSelected = true,
                      Speak = "P2PDemo"
                  },
                  new Choice()
                  {
                      Title = "SalesDemo",
                      Value = "SalesDemo",
                      IsSelected = false,
                      Speak = "SalesDemo"
                  }
              }
          });
      card.Body.Add(
          new TextInput()
          {
              Id = "idBranchName",
              IsRequired = true,
              Placeholder = "App Branch",
              MaxLength = 100,
              IsMultiline = false,
              Style = TextInputStyle.Text,
              // Value = ""
          });
  
      var submitActionData = JObject.Parse("{ \"Type\": \"idServerURL\" }");
  
  
      card.Actions.Add(
          /*  new SubmitAction()
          {
              Title = "Submit",
              // Speak = "Submit",
              Data = Newtonsoft.Json.Linq.JObject.FromObject(new { button = "Submit", ServerUrl = "idServerURL" })
          }
          */
          new SubmitAction()
          {
              DataJson = submitActionData.ToString()
          });
  
      var attachment = new Attachment() { ContentType = AdaptiveCard.ContentType, Content = card };
      return attachment;
  }
  </code></pre>
  
  <p>Exception from Emulator:</p>
  
  <pre><code>"contentType": "text/plain",
  "content": "   at System.Uri.EscapeDataString(String stringToEscape)
      at Microsoft.Bot.Builder.Luis.LuisRequest.BuildUri(ILuisModel model)
      at Microsoft.Bot.Builder.Luis.LuisService.Microsoft.Bot.Builder.Luis.ILuisService.BuildUri(LuisRequest luisRequest)
      at Microsoft.Bot.Builder.Luis.Extensions.&lt;QueryAsync&gt;d__4.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.LuisDialog`1.&lt;MessageReceived&gt;d__8.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume`1.&lt;Rest&gt;d__5.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.&lt;Microsoft-Bot-Builder-Internals-Fibers-IWait&lt;C&gt;-PollAsync&gt;d__19.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Internals.Fibers.Frame`1.&lt;Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop&lt;C&gt;-PollAsync&gt;d__9.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Internals.Fibers.Fiber`1.&lt;Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop&lt;C&gt;-PollAsync&gt;d__16.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.Microsoft.Bot.Builder.Internals.Fibers.IAwaiter&lt;T&gt;.GetResult()
      at Microsoft.Bot.Builder.Dialogs.Chain.LoopDialog`1.&lt;ResumeAsync&gt;d__3.MoveNext()
      -- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume`1.&lt;Rest&gt;d__5.MoveNext()
      --- End of stack trace from previous location where exception was thrown --
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Internals.Fibers.Wait`2.&lt;Microsoft-Bot-Builder-Internals-Fibers-IWait&lt;C&gt;-PollAsync&gt;d__19.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Internals.Fibers.Frame`1.&lt;Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop&lt;C&gt;-PollAsync&gt;d__9.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Internals.Fibers.Fiber`1.&lt;Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop&lt;C&gt;-PollAsync&gt;d__16.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.&lt;Microsoft-Bot-Builder-Base-IEventLoop-PollAsync&gt;d__23.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.ReactiveDialogTask.&lt;Microsoft-Bot-Builder-Base-IEventLoop-PollAsync&gt;d__3.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.ScoringEventLoop`1.&lt;Microsoft-Bot-Builder-Base-IEventLoop-PollAsync&gt;d__5.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.EventLoopDialogTask.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__3.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.SetAmbientThreadCulture.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__3.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.QueueDrainingDialogTask.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__4.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__3.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__3.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__2.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__4.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.&lt;Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync&gt;d__5.MoveNext()"
  </code></pre>