title: C# Irony Parser - Won't parse file despite everything seems correct
body: <p>I am having some tricky problems with Irony which I do not understand...</p>
  
  <p>The first parsing I do in the runtime of my application succeeds.</p>
  
  <pre><code>string src = "" // this is the file to parse
  Grammar g = new CSharpGrammar();
  LanguageData language = new LanguageData(g);
  Parser parser = new Parser(language);
  ParseTree parseTree = parser.Parse(src);
  ParseRoot = parseTree.Root;
  </code></pre>
  
  <p>Then I followed one hint to move the LanguageData variable to the global context. Still everything ok. But now I wanted to call the Irony parser inside of custom functions, parsing multiple files with the c# grammar v3.5 provided by Irony (LINQ queries are not important to me, so that seems sufficient). Same approach:</p>
  
  <pre><code>Parser parser = new Parser(language);
  ParseTree parseTree = parser.Parse(file);
  ParseRoot = parseTree.Root;
  </code></pre>
  
  <p>But now the parseroot is and remains "null". And I have absolutely no idea why. I also checked the parser errors a moment ago, there I recognized an error I cannot comprehend.</p>
  
  <pre><code>"Syntax error, expected: statement, member declaration, namespace"
  </code></pre>
  
  <p>But my file looks like this:</p>
  
  <pre><code>using System;
  using Microsoft.SharePoint.WebControls;
  
  namespace WebParts.Layouts.Ordering
  {
      public partial class ConfirmDelete : LayoutsPageBase
      {
          protected void Page_Load(object sender, EventArgs e)
          {
              lblMsg.Text = "Are you sure you want to delete the entry?";
  
              if (!IsPostBack)
              {
                  BtnYes.Attributes.Add("onclick", "OnYes(); return false;");
                  BtnNo.Attributes.Add("onclick", "OnNo(); return false;");
              }
          }
      }
  }
  </code></pre>
  
  <p>I hope you can see what's wrong with my code... I'm getting desperate with this thing...</p>