How to resolve SharpZipBaseException 'Header checksum illegal'?

2.1k Views Asked by At

I am currently working on an azure function that reads messages from a service bus queue. I am in a testing phase and my service bus queue gets about 50 messages per minute. (in a production environment it would be thousands of data points coming in per minute). When I run my function i get the following error (see error comment in code)

[FunctionName("ReadServiceBusMessage")]
        public static void ProcessMessagesAsync([ServiceBusTrigger("modbusdata", Connection = "test_RootManageSharedAccessKey_SERVICEBUS")]Message message, ILogger log)
        {
            try
            {
                log.LogInformation("Reading the message from queue");
                log.LogInformation("======================================================");

                string itemRaw;

                var data = new MemoryStream(message.Body);

                using (var istr = new InflaterInputStream(data))
                using (var rdr = new StreamReader(istr))
                {
                    itemRaw = rdr.ReadToEnd();//ERROR:ICSharpCode.SharpZipLib.SharpZipBaseException: 'Header checksum illegal'
                }

                log.LogInformation("Message encoding is completed.");
                log.LogInformation("========================================");

To be very honest I cannot find much useful information about what could be going on with this error. The closest I've came to finding a solution is that maybe i'm supposed to deflate the message instead of inflating, or inflating it within my code wont work because I am not working with enough data in the simulated environment. Thanks in advance for any guidance that can be provided.

0

There are 0 best solutions below