Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error XARLP7000: Xamarin.Tools.Zip.ZipException: Renaming temporary file failed: No such file or directory #9321

Open
jeromelaban opened this issue Sep 24, 2024 · 2 comments
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned.

Comments

@jeromelaban
Copy link

jeromelaban commented Sep 24, 2024

Android framework version

net8.0-android

Affected platform version

.NET 8 - 34.0.138

Description

On macOS, building an android app may fail with the following:

/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.138/tools/Xamarin.Android.EmbeddedResource.targets(39,5): error XARLP7000: Xamarin.Tools.Zip.ZipException: Renaming temporary file failed: No such file or directory
   at Xamarin.Tools.Zip.ZipArchive.Close() in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs:line 989
   at Xamarin.Android.Tasks.ZipArchiveEx.Dispose(Boolean disposing)
   at Xamarin.Android.Tasks.ZipArchiveEx.Dispose()
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.<>c__DisplayClass75_0.<CreateResourceArchive>b__0(String f)
   at Microsoft.Android.Build.Tasks.Files.ArchiveZipUpdate(String target, Action`1 archiver) in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/Files.cs:line 92
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.CreateResourceArchive(String resDir, String outputFile)
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(IDictionary`2 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments, ICollection`1 proguardConfigFiles)
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.RunTask()
   at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 [/Users/stephenhauck/Documents/GitHub/Uno.Samples/reference/SimpleCalc/CSharp-MVUX/SimpleCalculator/SimpleCalculator.csproj]

Steps to Reproduce

Build this solution: https://github.com/unoplatform/Uno.Samples/tree/master/reference/SimpleCalc/CSharp-MVUX.

It may work or fail randomly. This was reported by a user, I could not reproduce myself.

Did you find any workaround?

Rebuilding, maybe?

Relevant log output

The original binlog: unoplatform/uno#18192 (reply in thread)

@jeromelaban jeromelaban added Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned. labels Sep 24, 2024
@jonathanpeppers
Copy link
Member

Hmm, <ResolveLibraryProjectImports/> should be opening a .zip file in "readonly" mode. Should it use a temp file at all for that case?

Then I saw:

void CreateResourceArchive (string resDir, string outputFile)
{
var fileMode = File.Exists (outputFile) ? FileMode.Open : FileMode.CreateNew;
Files.ArchiveZipUpdate (outputFile, f => {
using (var zip = new ZipArchiveEx (f, fileMode)) {
zip.AddDirectory (resDir, "res");
}
});
}

Added for special chars in:

We could maybe do something for this case, but other .zip files could hit the same issue? It could also happen when writing an .apk. /cc @dellis1972 @grendello

@dellis1972
Copy link
Contributor

I've seen this when the OS runs out of file handles. I had to change the ulimit to be unlimited to work around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned.
Projects
None yet
Development

No branches or pull requests

3 participants