[PR #895] [MERGED] use File.OpenRead instead of File.Open in tests to allow concurrent access #1317

Open
opened 2026-01-29 22:19:57 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/895
Author: @Morilli
Created: 2/11/2025
Status: Merged
Merged: 2/11/2025
Merged by: @adamhathcock

Base: masterHead: fix-test-concurrency


📝 Commits (1)

  • d560b46 use File.OpenRead instead of File.Open to allow concurrent access

📊 Changes

2 files changed (+8 additions, -8 deletions)

View changed files

📝 tests/SharpCompress.Test/Zip/ZipArchiveTests.cs (+5 -5)
📝 tests/SharpCompress.Test/Zip/ZipReaderTests.cs (+3 -3)

📄 Description

When running all tests concurrently, it could happens that multiple tests accessed the same test file at the same time.

This should not be an issue when just reading the files, however the usage of File.Open without a FileShare parameter made the access exclusive and caused each subsequent call to fail. This was especially noticable in the Zip_Uncompressed_64bit test due to the long time it takes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/895 **Author:** [@Morilli](https://github.com/Morilli) **Created:** 2/11/2025 **Status:** ✅ Merged **Merged:** 2/11/2025 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `fix-test-concurrency` --- ### 📝 Commits (1) - [`d560b46`](https://github.com/adamhathcock/sharpcompress/commit/d560b46c85eed0e5153bd15086ace16f9e94d649) use File.OpenRead instead of File.Open to allow concurrent access ### 📊 Changes **2 files changed** (+8 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `tests/SharpCompress.Test/Zip/ZipArchiveTests.cs` (+5 -5) 📝 `tests/SharpCompress.Test/Zip/ZipReaderTests.cs` (+3 -3) </details> ### 📄 Description When running all tests concurrently, it could happens that multiple tests accessed the same test file at the same time. This should not be an issue when just reading the files, however the usage of `File.Open` without a `FileShare` parameter made the access exclusive and caused each subsequent call to fail. This was especially noticable in the `Zip_Uncompressed_64bit` test due to the long time it takes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:19:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1317