Unplanned
Last Updated: 04 Mar 2025 08:03 by Flemming
Flemming
Created on: 04 Mar 2025 08:03
Category: SpreadProcessing
Type: Bug Report
0
SpreadProcessing: ArgumentOutOfRangeException: 'Specified argument was out of the range of valid values. (Parameter 'delay') when using timeout with Timespan.MaxValue
This is a sample code to replicate the error which is triggered on export: 
            string inputFileName = "input.xlsx";
            if (!File.Exists(inputFileName))
            {
                throw new FileNotFoundException(String.Format("File {0} was not found!", inputFileName));
            }

            Telerik.Windows.Documents.Spreadsheet.Model.Workbook workbook;
            IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();

            using (Stream input = new FileStream(inputFileName, FileMode.Open))
            { 
                workbook = formatProvider.Import(input, TimeSpan.MaxValue);
            }
            string outputFilePath = "output.xlsx";

            using (Stream output = new FileStream(outputFilePath, FileMode.Create))
            {
                formatProvider.Export(workbook, output, TimeSpan.MaxValue);
            }
            Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
0 comments