Skip to content

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

Open

Description

@jeromelaban

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)

Activity

  1. jonathanpeppers commented on Sep 24, 2024

    @jonathanpeppers
    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

  2. dellis1972 commented on Sep 24, 2024

    @dellis1972
    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

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions