title: Roslyn CSharpSyntaxTree.ParseText add reference System.Runtime
body: <p>I have copied from Roslyn Pluralsight tutorial this code.</p>
  
  <pre><code>string code = "class Foo { }";
  
  var tree = CSharpSyntaxTree.ParseText(code);
  var node = tree.GetRoot();
  
  Console.WriteLine(node.ToString());
  
  var ret = SyntaxFactory.ClassDeclaration("Foo").
      WithMembers(SyntaxFactory.List&lt;MemberDeclarationSyntax&gt;(new[] {
          SyntaxFactory.MethodDeclaration(SyntaxFactory.
          PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword)),
          "Bar"
          ).WithBody(SyntaxFactory.Block()
          )
  })).NormalizeWhitespace();
  
  Console.WriteLine(ret.ToString());`
  </code></pre>
  
  <p>In Debug mode I see that variables "node" and "ret" silently throw this error: </p>
  
  <blockquote>
    <p>"The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".</p>
  </blockquote>
  
  <p>In Roslyn Plurarsight video tutorial "Creating Syntax Trees Using the APIs" there is no problem with this. </p>
  
  <p>How do I attach reference to CSharpSyntaxTree class.</p>
  
  <p><strong>Edit:</strong> <br />
  I am using Visual Studio 2015 Preview.</p>
  
  <p><img src="https://i.stack.imgur.com/IzphU.png" alt="Error in my Visual Studio 2015 Preview"></p>
  
  <p>In Pluralsight video there is no error in this simple code</p>
  
  <p><img src="https://i.stack.imgur.com/2HOTo.png" alt="Pluralsight video"></p>
  
  <p><strong>Edit:</strong> <br/></p>
  
  <p>The problem is only in Visual Studio tooltip. I can use Syntax Tree API without any problems. For example this code writes nodes and tokens without any weird exceptions, but Visual Studio won't show me syntax tree in tooltip while debugging code.</p>
  
  <pre><code>static void PrintSyntaxTree(SyntaxNode node)
  {
      if (node != null)
      {
          foreach (var item in node.ChildTokens())
          {
              Console.Write(item);
          }
          Console.WriteLine("");
          foreach (SyntaxNode child in node.ChildNodes())
              PrintSyntaxTree(child);
      }
  }
  
  static void Main(string[] args)
  {
      string code = "class Foo { public void Bar(){} }";
  
      var tree = CSharpSyntaxTree.ParseText(code);
  
      var node = tree.GetRoot();
  
      foreach (SyntaxNode child in node.ChildNodes())
      {
          PrintSyntaxTree(child);
      }
  }
  </code></pre>