GroupDocs.Parser.Parser(Stream document) - Value cannot be null. Parameter name: source

Stumbled across an odd and unexpected issue whereby this programmatically generated zip file encounters the “Value cannot be null. Parameter name: source” exception.
It appears that the text file content somehow creates a zip file whereby the GroupDocs.Parser isn’t able to handle when doing Stream parsing.
Parsing using filename with extension or specifying FileFormat.Archive works fine.
Guess the exception occurs when the parser is trying to figure out the format of the stream.

Odd this is that by simply changing the text file content to something else will not hit the exception.

            string file1 = Path.Combine(zipFolder, "a.txt");
            File.WriteAllText(file1, "The quick brown fox jumps over the lazy dog");

            string zipFilePath = Path.Combine(tmpFolder, "test.zip");

            System.IO.Compression.ZipFile.CreateFromDirectory(zipFolder, zipFilePath);

            try
            {
                using (FileStream s = File.OpenRead(zipFilePath))
                {
                    using (GroupDocs.Parser.Parser parser = new GroupDocs.Parser.Parser(s)) //, new GroupDocs.Parser.Options.LoadOptions(GroupDocs.Parser.Options.FileFormat.Archive)))
                    {
                        var cItems = parser.GetContainer();
                        Console.WriteLine($"Count = {cItems.Count()}");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

1 Like

@jarrodwee

Could you please share the problematic ZIP as well and which API version you are using?

Here’s the zip that is created by the above code:
test.zip (152 Bytes)

@jarrodwee
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PARSERNET-2287

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as PARSERNET-2287) have been fixed in this update. This message was posted using Bugs notification tool by atir.tahir