As stated in my original post, the Out of Memory exception is occurring when decompressing the XML from the XLSX file, not when reading the XML. The root cause is from the call to the ToArray method against the decompressed stream. This step essentially writes the entire content to the current process's memory as a byte array.
The only way to solve something like this is to change the architecture to pass a stream reference instead of a byte array.
BTW, I'm not saying that there is not an issue with the XmlDocument object and large files. I'm saying that the issue I am reporting is occurring well before it even gets to that point in the code.
The only way to solve something like this is to change the architecture to pass a stream reference instead of a byte array.
BTW, I'm not saying that there is not an issue with the XmlDocument object and large files. I'm saying that the issue I am reporting is occurring well before it even gets to that point in the code.