You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the LoadHtml method of an HtmlDocument instance that has the property OptionCheckSyntax set to false, a NullReferenceException is thrown if the input HTML has any unclosed tags or is invalid in any way. I'm not sure if this is expected or As Designed but I couldn't find any information about it.
Exception
Exception message: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
Stack trace:
at HtmlAgilityPack.HtmlNode.UpdateLastNode() in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlNode.cs:line 2009
at HtmlAgilityPack.HtmlNode.CloseNode(HtmlNode endnode, Int32 level) in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlNode.cs:line 2077
at HtmlAgilityPack.HtmlNode.CloseNode(HtmlNode endnode, Int32 level) in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlNode.cs:line 2056
at HtmlAgilityPack.HtmlDocument.CloseCurrentNode() in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlDocument.cs:line 1077
at HtmlAgilityPack.HtmlDocument.PushNodeEnd(Int32 index, Boolean close) in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlDocument.cs:line 2061
at HtmlAgilityPack.HtmlDocument.Parse() in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlDocument.cs:line 1391
at HtmlAgilityPack.HtmlDocument.Load(TextReader reader) in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlDocument.cs:line 771
at HtmlAgilityPack.HtmlDocument.LoadHtml(String html) in C:\Users\Jonathan\source\repos\HtmlAgilityPack\HtmlAgilityPack.Shared\HtmlDocument.cs:line 819
at Program.Main()
Description
When using the
LoadHtml
method of anHtmlDocument
instance that has the propertyOptionCheckSyntax
set tofalse
, aNullReferenceException
is thrown if the input HTML has any unclosed tags or is invalid in any way. I'm not sure if this is expected or As Designed but I couldn't find any information about it.Exception
Fiddle or Project
https://dotnetfiddle.net/9NZotJ
Further technical details
The text was updated successfully, but these errors were encountered: