ExcelMapper icon indicating copy to clipboard operation
ExcelMapper copied to clipboard

The SaveAsync taking a stream is failing because the Workbook.Save is…

Open MKleisinger opened this issue 4 years ago • 5 comments

… closing the created memory stream before it can copy the data into the users passed in stream. Adding a memory stream overriding close will fix this issue.

MKleisinger avatar May 19 '21 16:05 MKleisinger

Codecov Report

Merging #125 (5f460d7) into master (756dc26) will decrease coverage by 0.12%. The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #125      +/-   ##
==========================================
- Coverage   93.79%   93.67%   -0.13%     
==========================================
  Files           9        9              
  Lines        1193     1201       +8     
  Branches      171      172       +1     
==========================================
+ Hits         1119     1125       +6     
- Misses         47       48       +1     
- Partials       27       28       +1     
Impacted Files Coverage Δ
ExcelMapper/ExcelMapper.cs 94.55% <83.33%> (-0.21%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 756dc26...5f460d7. Read the comment docs.

codecov[bot] avatar May 19 '21 16:05 codecov[bot]

Tests are failing because the implemented non-closing stream is not being closed in any tests.

MKleisinger avatar May 19 '21 16:05 MKleisinger

I can't repro the failure. The MemoryStream's buffer is still available after it is closed. See this answer at StackOverflow: https://stackoverflow.com/a/3981274/1970064

mganss avatar May 20 '21 09:05 mganss

The way I was able to repro it was to attempt to write the stream to an excel file. The excel file would be created; however, the worksheet was blank. When debugging I noticed that the stream had already been closed.

MKleisinger avatar Jul 08 '21 18:07 MKleisinger

Can you post a code snippet that shows the issue?

mganss avatar Jul 09 '21 09:07 mganss