Skip to content

NullReferenceException while calling CQ.Create() #207

@Israel4Ever

Description

@Israel4Ever

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions