Skip to content

Fix TempFile usage while temp dir was deleted in same process#1132

Merged
tonyqus merged 29 commits into
nissl-lab:masterfrom
Bykiev:FixBug926
Apr 26, 2024
Merged

Fix TempFile usage while temp dir was deleted in same process#1132
tonyqus merged 29 commits into
nissl-lab:masterfrom
Bykiev:FixBug926

Conversation

@Bykiev
Copy link
Copy Markdown
Collaborator

@Bykiev Bykiev commented Jul 27, 2023

This PR closes #926

@Bykiev Bykiev marked this pull request as draft July 27, 2023 08:55
@Bykiev
Copy link
Copy Markdown
Collaborator Author

Bykiev commented Jul 27, 2023

Cannot make test running on CI, help is wanted. It seems they're running in parallel, I've tried to add [NonParallelizable] and [SingleThreaded] attributes with no luck

Comment thread main/Util/TempFile.cs
{
dir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "poifiles")).FullName;
string tempDir = Path.Combine(Path.GetTempPath(), "poifiles");
dir = Directory.CreateDirectory(tempDir).FullName;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateDirectory always called so shouldn't actually be dir be assigned tempdirs value?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't change much code, but dir variable doesn't needed at all

Comment thread main/Util/TempFile.cs
Directory.CreateDirectory(dir);

Random rnd = new Random(DateTime.Now.Millisecond);
Thread.Sleep(10);
Copy link
Copy Markdown
Collaborator Author

@Bykiev Bykiev Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of Thread.Sleep?

@Bykiev Bykiev mentioned this pull request Sep 9, 2023
@tonyqus tonyqus added the bug label Dec 14, 2023
@tonyqus tonyqus added this to the NPOI 2.7.1 milestone Dec 14, 2023
@Bykiev Bykiev marked this pull request as ready for review March 12, 2024 16:20
@Bykiev Bykiev requested a review from lahma March 12, 2024 16:20
@Bykiev Bykiev requested a review from tonyqus April 3, 2024 09:52
@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Apr 26, 2024

@Bykiev There is a conflict. Can you fix it?

@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Apr 26, 2024

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CreateTempFile throws DirectoryNotFoundException for SXSSFWorkbook

3 participants