title: CustomMessageBox from Windows Phone 8 Toolkit throw NullPointerException
body: <p>Code for creating the <code>CustomMessageBox</code>:</p>
  
  <p><code>CustomMessageBox</code> is a property, and not a reference to the C# Class in the Toolkit.</p>
  
  <pre><code>CustomMessageBox.Dismissed += (dismissSender, dismissedEvent) =&gt;
  {
      switch (dismissedEvent.Result)
      {
          case CustomMessageBoxResult.LeftButton:
              PlaceCall(clickedFavorite.Name, clickedFavorite.PhoneNo);
              break;
          case CustomMessageBoxResult.RightButton:
              HERE ---&gt; SendText(clickedFavorite.PhoneNo);
              break;
      }
  };
  </code></pre>
  
  <p>Code for <code>SendText()</code> method:</p>
  
  <pre><code>private void SendText(String phoneNo)
  {
      var smsTask = new SmsComposeTask
                        {
                            To = phoneNo
                        };
  
      smsTask.Show();
  }
  </code></pre>
  
  <p>Thing is when the <code>SmsComposeTask</code> has started, the Phone navigates to the SMS application, which is correct.</p>
  
  <p>If the user then decides to go back, with the Hardware Back Button, the SMS application closes and the phone shows my app again - but immediately closes, caused by a NullPointerException:</p>
  
  <pre><code>   at Microsoft.Phone.Controls.CustomMessageBox.ClosePopup(Boolean restoreOriginalValues)
     at Microsoft.Phone.Controls.CustomMessageBox.&lt;&gt;c__DisplayClass4.&lt;Dismiss&gt;b__1(Object s, EventArgs e)
     at Microsoft.Phone.Controls.Transition.OnCompleted(Object sender, EventArgs e)
     at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
     at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
  </code></pre>
  
  <p>I have also tried to override the <code>OnBackKeyPress</code> event, like this:</p>
  
  <pre><code>protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
  {
      if (CustomMessageBox != null &amp;&amp; CustomMessageBox.IsEnabled)
      {
          e.Cancel = true;
      }
      else
      {
          base.OnBackKeyPress(e);
      }
  }
  </code></pre>
  
  <p><strong>Does anyone know what to do?</strong></p>