Skip to content

[BUG] - MaxSynthesizedCells (default 100,000) is a breaking behavior change but is not listed in breaking changes / upgrade notes #1075

Done

Description

@karczk-dnv

Description

After upgrading from 1.38.0 to 2.0.0 (legacy MiniExcelLibs API), reading worksheets that worked before started failing with:

System.IO.InvalidDataException: The worksheet exceeds the configured limit of 100000 synthesized empty cells.
   at MiniExcelLib.OpenXml.Reader.OpenXmlReader.<InternalQueryRange>d__62.MoveNext()

This came as a surprise, because I couldn't find it among the breaking changes. The limit was introduced in #1016 (2.0.0-preview.5) and backported in #1017 (1.47.0), but in both releases it only appears as a PR title in "What's Changed". It is not mentioned in V2-Upgrade-Notes.md either.

The budget is calculated as empty rows × requested width. With a wide endColumnIndex, each empty row costs the full width, so a worksheet with only ~100 empty rows (e.g. spacing between sections) already exceeds the default.

Minimal repro (worksheet with a value in A1 and A150, nothing in between):

using MiniExcelLibs;

using var stream = File.OpenRead("sample.xlsx");
var rows = stream.QueryRange(
        sheetName: "Sheet1",
        startColumnIndex: 1,
        endColumnIndex: 1000)
    .ToList(); // throws: 148 empty rows × 1000 columns = 148,000 > 100,000

Expected Behavior

Either the same behavior as in 1.x for a small worksheet, or a clearly documented breaking change (release notes + upgrade notes) with the default value and the setting needed to adjust it.

Actual Behavior

InvalidDataException is thrown for a small worksheet. The message does not say which setting controls the limit.

Workarounds

Pass a configuration with a higher limit:

var config = new OpenXmlConfiguration { MaxSynthesizedCells = 10_000_000 };
stream.QueryRange(sheetName: "Sheet1", startColumnIndex: 1, endColumnIndex: 1000, configuration: config);

Environment (please fill the following information):

  • MiniExcel Version: 2.0.0 (upgraded from 1.38.0)
  • .NET Version: net10.0
  • OS: Windows, Linux

Files and/or Screenshots

Not needed – any worksheet with a value in A1 and A150 and nothing in between reproduces the issue.

Additional Context

Suggestions:

  1. List the new limit and its default under breaking changes in the release notes (2.0.0 / 1.47.0) and in V2-Upgrade-Notes.md.
  2. Mention the setting in the exception message, e.g. ... Increase OpenXmlConfiguration.MaxSynthesizedCells or set it to null to disable the limit.
  3. Document that the budget scales with the requested column range: each empty row counts as endColumnIndex - startColumnIndex + 1 cells, so a wide QueryRange reaches the default limit after only a few empty rows.

Related: #1016, #1017

Activity

  1. added
    bug
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions