FileFormatUtil.DetectFileFormat throws 'The File is corrupted' using a stream object

We have a use case where a background job fetches a valid .xlsx file from an api and it is converted to a MemoryStream and then use this to parse as a Workbook. Before parsing it as a workbook object, we have a precondition to check the file info first to confirm if it is password protected. We noticed that in our local machine debugging, the FileFormatUtil.DetectFileFormat(stream) throws a CellsException.IO(18) with message ‘The file is corrupted’ (line 373 in the screenshot). However, in the hosted environments, it runs fine and no issues. In addition, we can confirm that the file isn’t corrupted if we commented the precondition and directly convert it to a Workbook object which runs fine (line 382 in the screenshot) . Please see attached image.

Version: 18.5.1.0
Platform: .NET 8/.NET 6

image.png (57.2 KB)

@DaveSuico
Could you share your template file here? We will check it ASAP.

This is now fixed via:

@DaveSuico
Thank you for your feedback. We are glad your issue has been resolved.