BUG: OpenXml 3.x: SpreadsheetDocument.Open(Stream, false) requires temp/write access (breaks read-only environments)
- Dominant language
- C#
- Stars
- 4.6k
- Forks
- 605
- PR merge metrics
- No merged PRs in 30d
Description
We are encountering a breaking change after upgrading from DocumentFormat.OpenXml 2.x to 3.x when opening Excel files from an in-memory stream in a strictly read-only runtime environment.
The same code worked reliably in 2.x but fails in 3.x in environments where file system write access (e.g., /tmp) is not available or permitted.
`using (var stream = new MemoryStream(fileData))
{
using (SpreadsheetDocument document = SpreadsheetDocument.Open(stream, false))
{
}
}`
Expected Behavior
The document should open successfully in read-only mode (isEditable: false)
No attempt should be made to write to disk or use temp storage
Behavior should remain compatible with OpenXml 2.x, where this worked without requiring any writable filesystem
Actual Behavior
In OpenXml 3.x, the same code fails when running in a containerized / restricted environment (e.g., Kubernetes POD) where:
No /tmp directory is available, or
Write access to filesystem is restricted
The library appears to attempt file system access (likely temp file creation or packaging internals), causing runtime failure
Contributor guide
Research direction
Start by reproducing the MemoryStream example with SpreadsheetDocument.Open(stream, false) in a container or runtime without writable filesystem access, then trace where the failure attempts temporary or filesystem access. Done means a read-only document opens successfully without /tmp or any other writable storage, while preserving the OpenXml 2.x behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100