title: Loading a file with XamlServices
body: <p>I'm having trouble trying to figure out how to fix this error. I've tried googling it and cannot find an answer that matches what I am doing. I have no idea on how to fix it. I hope I have a good explanation of my problem below. Can someone please help and explain it to me?</p>
  
  <p>Error Message:</p>
  
  <pre><code>Cannot create unknown type 
  '{clr-namespace:System.Collections.Generic;assembly=mscorlib}List    
  ({clr-namespace:Ventana.Simulator.Support;assembly=Extractor} Message)'.' 
  Line number '1' and line position '2'
  </code></pre>
  
  <p>Errors on this line:</p>
  
  <pre><code>Message receivedMessages = (Message)XamlServices.Load("Data/ReceivedMessages.xaml");
  </code></pre>
  
  <p>Here is a sample of the file I am trying to load:</p>
  
  <pre><code>&lt;List x:TypeArguments="vss:Message" Capacity="32768" 
        xmlns="clr-namespace:System.Collections.Generic;assembly=mscorlib"  
        xmlns:vss="clr-namespace:BusinessApp.Simulator.Support;assembly=Extractor"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
    &lt;vss:Message Address="2" BroadcastByte="120" InteractionID="0"
         IsHandled="False" MessageType="Rx"&gt;
    &lt;vss:Message.RawMessage&gt;
     &lt;x:Array Type="x:Byte"&gt;
      &lt;x:Byte&gt;120&lt;/x:Byte&gt;
      &lt;x:Byte&gt;0&lt;/x:Byte&gt;
      &lt;x:Byte&gt;2&lt;/x:Byte&gt;
      &lt;x:Byte&gt;4&lt;/x:Byte&gt;
      &lt;x:Byte&gt;0&lt;/x:Byte&gt;
      &lt;x:Byte&gt;39&lt;/x:Byte&gt;
      &lt;x:Byte&gt;254&lt;/x:Byte&gt;
      &lt;x:Byte&gt;16&lt;/x:Byte&gt;
      &lt;x:Byte&gt;197&lt;/x:Byte&gt;
      &lt;x:Byte&gt;28&lt;/x:Byte&gt;
     &lt;/x:Array&gt;
    &lt;/vss:Message.RawMessage&gt;
    &lt;/vss:Message&gt;
  &lt;/List&gt;
  </code></pre>
  
  <p>Here is a snippett of code I do to save it...from a different application.</p>
  
  <pre><code>private static List&lt;Message&gt; receiveMessages = new List&lt;Message&gt;();
  
  // line is populated by a file and this is a sample of what line would have.
  string line = "2014-11-26 09:46:56.043\tDEBUG\t11\tSerialPairedExecutable\tRx: 78-F0-02-7F-00-27-    68-1C [EOL]";
  
  const string rxMessage = "Rx: "
  
  message = line.ExtractMessage(line, rxMessage, 3);
  
  string[] array = message.ToArray()[0].Value.Split('-');
  
  int broadcastByte = Convert.ToInt32(array[0].ToString(), 16);
  
  int interactionId = Convert.ToInt32(array[1].ToString(), 16);
  
  int address = Convert.ToInt32(array[2].ToString(), 16);
  
  byte[] bytes = array.Select(s =&gt; Convert.ToByte(s, 16)).ToArray();
  
  receiveMessages.Add(new Message()
  {
      BroadcastByte = Convert.ToByte(broadcastByte),
      InteractionID = Convert.ToByte(interactionId),
      Address = Convert.ToByte(address),
      MessageType = MessageType.Rx,
      RawMessage = bytes
  });
  </code></pre>
  
  <p>Where the <code>Message</code> class is defined as:</p>
  
  <pre><code>public class Message : IMessage
  {
      [DataMember]
      public MessageType MessageType{ get; set; }
  
      [DataMember]
      public byte[] RawMessage { get; set; }
  
      [DataMember]
      public byte BroadcastByte { get; set; }
  
      [DataMember]
      public byte InteractionID { get; set; }
  
      [DataMember]
      public byte Address { get; set; }
  
      public bool IsHandled { get; set; }
  }
  </code></pre>