HtmlNode.WriteTo() and HtmlNode.WriteContentTo() causes a memory leak not closing the StringStream opened.
public string WriteTo()
{
StringWriter sw = new StringWriter();
WriteTo(sw);
sw.Flush();
return sw.ToString();
}
Should be
public string WriteTo()
{
StringWriter sw = new StringWriter();
WriteTo(sw);
sw.Flush();
string s = sw.ToString();
sw.Close();
return s;
}
Or better yet, using {} block