Htmlagilitypack Expression Cannot Contain Lambda Expressions
Solution 1:
The Expression cannot contain lambda expressions
message doesn't come from the HTMLAgilityPack but from the QuickWatch feature. Basically, a lambda expression is just a syntaxic sugar: upon compilation the lambda is converted to a 'real' function. Since it's something happening during compilation, you can't create a brand new lambda at runtime (that is, in the QuickWatch window).
Now the question is: why is lblNotes.Text
empty? Unfortunately, I can't know without seeing the HTML code. Though, if there's no error, it means that the "album_notes" div has been found (otherwise you would have a null reference exception). Therefore, the InnerHtml
property is probably empty.
You can check that by rewriting your code a bit:
public void Album_Notes(HtmlAgilityPack.HtmlDocument bandHTML)
{
var div = bandHTML.DocumentNode.Descendants("div").First(x => x.Id == "album_notes");
this.lblNotes.Text = div.InnerHtml;
}
This way, if you put a breakpoint on the last line, you can check the value of div
and div.InnerHtml
in the quickwatch window.
Post a Comment for "Htmlagilitypack Expression Cannot Contain Lambda Expressions"