title: C# UWP - cannot connect to the serial port
body: <p>I'm working on UWP app and need to read data from a serial port and display them on the graph. </p>
  
  <p><strong>I'm getting 3 random exception messages :</strong></p>
  
  <blockquote>
    <p><strong><em>Message 1 :</em></strong> 
    <code>"The operation completed successfully"</code></p>
    
    <p><strong><em>Message 2 :</em></strong>
    <code>"An attempt was made to reference a token that does not exist"</code></p>
    
    <p><strong><em>Message 3 :</em></strong> 
    <code>"The requested lookup key was not found in any active activation
     context"</code></p>
  </blockquote>
  
  <p>I don't have a live connection, but I installed a simulator. When I'm trying to establish a connection from the console app it works fine.</p>
  
  <p><strong>Here is my code, which is really simple:</strong></p>
  
  <pre><code>_serialPort = new SerialPort(portName, baudRate);
  _serialPort.DataReceived += _serialPort_DataReceived;
  try
  {
      _serialPort.Open();
  }
  catch (Exception ex)
  {
  
  }
  </code></pre>
  
  <p>From the <code>_serialPort_DataReceived</code> method I want to update the graph. </p>
  
  <p>I know that there is some limitation with the serial port on UWP, but I can't find an appropriate solution.</p>
  
  <p>There are similar questions on Stack Overflow, but none of the answers are a solution to my problem.</p>