dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.06k forks source link

Single-file apps are not re-extracted if folder in temp is empty in .NET Core 3 #17190

Open jespergustinmsft opened 3 years ago

jespergustinmsft commented 3 years ago

Windows periodically deletes files in %temp% but keep the folder of the extracted single-file app. And it seems that the files are not re-extracted if the folder already exists (and empty).

This seems to be fixed in .NET 5(?) as I have not been able to reproduce it there.

How to reproduce:

  1. Publish a single-file app (MyApp.exe in this case)
  2. Run it (to produce a temporary folder, e.g. C:\Users\user\AppData\Local\Temp.net\MyApp\vslj0aom.wch)
  3. Delete the contents of vslj0aom.wch, but keep the folder, to mimic the behavior of the periodical Windows clean-up
  4. Try to start MyApp.exe again

RESULT: Application won't start, because files are not re-extracted to %temp%.net\MyApp if vslj0aom.wch exists and empty. EXPECTED RESULT: Application starts regardless of the state of the temporary directory (with files).

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.