You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: https://dev.azure.com/DevDiv/DevDiv/_workitems/edit/1782014
Context: 9166e03
On Windows customers are seeing the following error:
error XABLD7000: Xamarin.Tools.Zip.ZipException: Renaming temporary file failed: Permission denied
at Xamarin.Tools.Zip.ZipArchive.Close() in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs:line 939
We have traced this to the use of the [`MoveFileExW()`][0] /
`MoveFileExA()` API: when libzip is trying to move its temp file to
the final location, Windows is raising this error:
Renaming temporary file failed: Permission denied
Turning off Anti Virus seems to help, however adding an exclusion
does not. This is very confusing, so we are unsure why this error is
being raised. The process has the correct permissions and the file
being moved is in the same directory, so its not a TEMP folder issue.
Perhaps it's the number of temp files we create? Part of the
`<BuildApk/>` system is that as we add files we `Flush()` the zip
file to commit those changes to disk. This is partly to work around
how libzip works: it does not write any data to the main file until
[`zip_close()`][1] is called. To work around issues around too many
files being open (9166e03), we added this flush.
The limit of 50 files was picked out of a hat. Try pushing the limit
up a bit to see if that helps.
Additionally, introduce the following two (private!) MSBuild
properties:
* `$(_ZipFlushFilesLimit)`: Call `Flush()` after
`$(_ZipFlushFilesLimit)` files have been added to the `.apk`.
* `$(_ZipFlushSizeLimit)`: Call `Flush()` after
`$(_ZipFlushSizeLimit)` bytes of data have been added to the
`.apk`.
[0]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw
[1]: https://libzip.org/documentation/zip_close.html
0 commit comments