title: c# winrt error 0x8001010E
body: <p>I've made a program that creates a thread and in that thread create image:</p>
  
  <pre><code>private async void GetCamera()
  {
     ....
      tk = new Task(MyAwesomeTask);
      tk.Start();
  
  }
  
  private async void MyAwesomeTask()
  {
          while (true)
          {
              await Task.Delay(TimeSpan.FromSeconds(0.5));
              SavePhoto1();
          }
  }
  
  private  void SavePhoto1()
  {
          try
          {
              WriteableBitmap wb1 = new WriteableBitmap(320, 240);//throw exception
          }catch (Exception ee)
          {
              String s = ee.ToString();
          }
  
  }
  </code></pre>
  
  <p>But line </p>
  
  <pre><code>WriteableBitmap wb1 = new WriteableBitmap(320, 240); 
  </code></pre>
  
  <p>throws exception:</p>
  
  <blockquote>
    <p>s="System.Exception: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))\r\n   at Windows.UI.Xaml.Media.Imaging.WriteableBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight)\r\n   at TestVideo.MainPage.SetImageFromStream() in ...\MainPage.xaml.cs:line 500\r\n   at TestVideo.MainPage.SavePhoto1() in ....\MainPage.xaml.cs:line 145"</p>
  </blockquote>
  
  <p>What I need to do?</p>