Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException while calling CQ.Create() #207

Open
Israel4Ever opened this issue Nov 3, 2015 · 0 comments
Open

NullReferenceException while calling CQ.Create() #207

Israel4Ever opened this issue Nov 3, 2015 · 0 comments

Comments

@Israel4Ever
Copy link

Hi,
I'm calling this code:

CQ dom = CQ.Create(
        duplicatedResult.StreamToFile,
        encoding,
        HtmlParsingMode.Auto,
        HtmlParsingOptions.IgnoreComments
    );

The stream of the file (duplicatedResult.StreamToFile) is the downloaded URL:
http://docsouth.unc.edu/fpn/green/green.html

and getting back this exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at CsQuery.HtmlParser.ElementFactory.Parse(Stream inputStream, Encoding encoding)
   at CsQuery.CQ.CreateNew(CQ target, Stream html, Encoding encoding, HtmlParsingMode parsingMode, HtmlParsingOptions parsingOptions, DocType docType)
   at ***.LogicLayers.Sources.HtmlSource.WebPageDocument.<>c__DisplayClass6_0.b__0() in C:\TFS\***\Development\LogicLayer\ContentDOM\HtmlModel\WebPageDocument.cs:line 134
   --- End of inner exception stack trace ---
   at ***.LogicLayers.Sources.HtmlSource.WebPageDocument.LoadDocument(Uri URL, DownloadingResult duplicatedResult, Encoding encoding) in C:\TFS\***\Development\LogicLayer\ContentDOM\HtmlModel\WebPageDocument.cs:line 149
   at ***.LogicLayers.Sources.HtmlSource.WebPageDocument..ctor(Uri URL, DownloadingResult dr) in C:\TFS\***\Development\LogicLayer\ContentDOM\HtmlModel\WebPageDocument.cs:line 44
   at ***.LogicLayer.BL.DocumentTypes.WebDocument..ctor(DownloadingResult dr) in C:\TFS\***\Development\LogicLayer\BL\DocumentTypes\WebDocument.cs:line 23
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at ***.LogicLayer.BL.DocumentTypes.WebDocument..ctor(DownloadingResult dr) in C:\TFS\***\Development\LogicLayer\BL\DocumentTypes\WebDocument.cs:line 31
   at ***.LogicLayer.BL.DocumentTypes.DocumentsFactory.Get(Uri url, Boolean hideAgent, eFileType[] allowedTypes) in C:\TFS\***\Development\LogicLayer\BL\DocumentTypes\DocumentsFactory.cs:line 35
   at ***.LogicLayer.SearchEngine.Results.TextualResultRecord.ParseUrl() in C:\TFS\***\Development\LogicLayer\SearchEngine\Results\TextualResultRecord.cs:line 34

Any tip for solving this?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant