catch when zipWriter dispose

ObjectDisposedException also appear when zipwriter dispose after user request cancel
This commit is contained in:
cdwcgt 2023-02-19 02:24:07 +09:00
parent 8446e7d841
commit 79715fe37b
1 changed files with 5 additions and 5 deletions

View File

@ -35,13 +35,13 @@ protected override void ExportToStream(TModel model, Stream outputStream, Progre
/// <param name="cancellationToken">The Cancellation token that can cancel the exporting.</param>
private void exportZipArchive(TModel model, Stream outputStream, ProgressNotification notification, CancellationToken cancellationToken = default)
{
using var writer = new ZipWriter(outputStream, new ZipWriterOptions(CompressionType.Deflate));
float i = 0;
bool fileMissing = false;
try
{
var writer = new ZipWriter(outputStream, new ZipWriterOptions(CompressionType.Deflate));
float i = 0;
bool fileMissing = false;
foreach (var file in model.Files)
{
cancellationToken.ThrowIfCancellationRequested();