xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] Error XARDF7024: System.IO.IOException: Directory not empty #15671

Closed knocte closed 1 year ago

knocte commented 1 year ago

Description

When trying to compile a Xamarin.Forms Android project that has always worked, now I'm getting a compilation error when hitting "Rebuild".

Steps to Reproduce

  1. Clone https://github.com/nblockchain/geewallet
  2. Switch to branch "frontend"
  3. Open gwallet-legacy.sln in the IDE (it's just called "legacy" because it's not migrated to Maui yet).
  4. Build project GWallet.Frontend.XF.Android.

Expected Behavior

Should build, like it has always built over the years (and like it builds in CI).

Actual Behavior

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error XARDF7024: System.IO.IOException: Directory not empty
  at System.IO.FileSystem.RemoveDirectoryInternal (System.IO.DirectoryInfo directory, System.Boolean recursive, System.Boolean throwOnTopLevelDirectoryNotFound) [0x00115] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:442 
  at System.IO.FileSystem.RemoveDirectory (System.String fullPath, System.Boolean recursive) [0x00020] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:365 
  at System.IO.Directory.Delete (System.String path, System.Boolean recursive) [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:298 
  at Xamarin.Android.Tasks.RemoveDirFixed.RunTask () [0x00058] in <fc1b00897d7e44c7b1a3950c1a222389>:0  (XARDF7024) (GWallet.Frontend.XF.Android)

Basic Information

Environment

Visual Studio Community 2022 for Mac
Version 17.4.2 (build 17)
Installation UUID: cf7666eb-c577-4c71-ac46-40154c7aca59

Runtime
.NET 6.0.12 (64-bit)
Architecture: X64

Roslyn (Language Service)
4.4.0-6.22578.12+3c6ab8e1715e5b080fb7bb77070810ab71e09387

NuGet
Version: 6.3.1.1

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/7.0.101/Sdks
SDK Versions:
    7.0.101
    7.0.100
    6.0.404
    6.0.403
    6.0.402
    6.0.401
    6.0.400
    6.0.302
    6.0.106
    6.0.104
    6.0.103
    6.0.102
    5.0.408
    5.0.407
    5.0.406
    5.0.404
    5.0.403
    5.0.402
    5.0.401
    5.0.400
    5.0.302
    3.1.426
    3.1.425
    3.1.424
    3.1.423
    3.1.422
    3.1.421
    3.1.420
    3.1.418
    3.1.417
    3.1.416
    3.1.415
    3.1.414
    3.1.413
    3.1.412
    3.1.411
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    7.0.1
    7.0.0
    6.0.12
    6.0.11
    6.0.10
    6.0.9
    6.0.8
    6.0.7
    6.0.6
    6.0.4
    6.0.3
    6.0.2
    5.0.17
    5.0.16
    5.0.15
    5.0.13
    5.0.12
    5.0.11
    5.0.10
    5.0.9
    5.0.8
    3.1.32
    3.1.31
    3.1.30
    3.1.29
    3.1.28
    3.1.27
    3.1.26
    3.1.24
    3.1.23
    3.1.22
    3.1.21
    3.1.20
    3.1.19
    3.1.18
    3.1.17

Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode 14.2 (21534)
Build 14C18

Xamarin.Mac
Version: 9.0.0.27 (Visual Studio Community)
Hash: 933c6c2c9
Branch: xcode14.1
Build date: 2022-11-22 02:00:36-0500

Xamarin.iOS
Version: 16.1.1.27 (Visual Studio Community)
Hash: 933c6c2c9
Branch: xcode14.1
Build date: 2022-11-22 02:00:37-0500

Xamarin Designer
Version: 17.4.0.136
Hash: d49c9ff6d3
Branch: remotes/origin/d17-4
Build date: 2022-12-13 04:22:27 UTC

Xamarin.Android
Version: 13.1.0.1 (Visual Studio Community)
Commit: xamarin-android/d17-4/13ba222
Android SDK: /Users/knocte/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        12.1 (API level 32)
        12.0 (API level 31)
        8.1  (API level 27)
        11.0 (API level 30)
        10.0 (API level 29)
        13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0

Build Information: 
Mono: a96bde9
Java.Interop: xamarin/java.interop/d17-4@fcc33ce2
SQLite: xamarin/sqlite/3.39.3@23e1ae7
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@0be567a

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.4.0.54
Hash: 6eabb9e
Branch: remotes/origin/d17-4
Build date: 2022-12-13 04:22:32 UTC

Android Device Manager
Version: 0.0.0.1206
Hash: 886af39
Branch: 886af39
Build date: 2022-12-13 04:22:32 UTC

Build Information
Release ID: 1704020017
Git revision: 7ef5413f2eec3351ce648085f619fc29fd8cb647
Build date: 2022-12-13 04:20:10+00
Build branch: release-17.4
Build lane: release-17.4

Operating System
Mac OS X 12.6.1
Darwin 21.6.0 Darwin Kernel Version 21.6.0
    Thu Sep 29 20:12:57 PDT 2022
    root:xnu-8020.240.7~1/RELEASE_X86_64 x86_64

Build Logs


Rebuilding...

Cleaning GWallet.Frontend.XF.Android (Debug)
Build started 23/1/2023 12:43:27 PM.
__________________________________________________
Project "/Users/knocte/Documents/Code/geewalletFRONTEND/src/GWallet.Frontend.XF.Android/GWallet.Frontend.XF.Android.fsproj" (Clean target(s)):

Target _GetProjectReferenceTargetFrameworkProperties:
    __________________________________________________
    Project "/Users/knocte/Documents/Code/geewalletFRONTEND/src/GWallet.Frontend.XF.Android/GWallet.Frontend.XF.Android.fsproj" is building "/Users/knocte/Documents/Code/geewalletFRONTEND/src/GWallet.Frontend.XF/GWallet.Frontend.XF.fsproj" (GetTargetFrameworks target(s)):

    __________________________________________________
    Project "/Users/knocte/Documents/Code/geewalletFRONTEND/src/GWallet.Frontend.XF.Android/GWallet.Frontend.XF.Android.fsproj" is building "/Users/knocte/Documents/Code/geewalletFRONTEND/src/GWallet.Backend.NetStandard/GWallet.Backend.NetStandard.fsproj" (GetTargetFrameworks target(s)):

Target _CleanMonoAndroidIntermediateDir:
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024: System.IO.IOException: Directory not empty
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at System.IO.FileSystem.RemoveDirectoryInternal (System.IO.DirectoryInfo directory, System.Boolean recursive, System.Boolean throwOnTopLevelDirectoryNotFound) [0x00115] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:442 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at System.IO.FileSystem.RemoveDirectory (System.String fullPath, System.Boolean recursive) [0x00020] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:365 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at System.IO.Directory.Delete (System.String path, System.Boolean recursive) [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:298 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at Xamarin.Android.Tasks.RemoveDirFixed.RunTask () [0x00058] in <fc1b00897d7e44c7b1a3950c1a222389>:0 
Done building target "_CleanMonoAndroidIntermediateDir" in project "GWallet.Frontend.XF.Android.fsproj" -- FAILED.

Done building project "GWallet.Frontend.XF.Android.fsproj" -- FAILED.

Build FAILED.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024: System.IO.IOException: Directory not empty
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at System.IO.FileSystem.RemoveDirectoryInternal (System.IO.DirectoryInfo directory, System.Boolean recursive, System.Boolean throwOnTopLevelDirectoryNotFound) [0x00115] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:442 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at System.IO.FileSystem.RemoveDirectory (System.String fullPath, System.Boolean recursive) [0x00020] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:365 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at System.IO.Directory.Delete (System.String path, System.Boolean recursive) [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:298 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2490,2): error XARDF7024:   at Xamarin.Android.Tasks.RemoveDirFixed.RunTask () [0x00058] in <fc1b00897d7e44c7b1a3950c1a222389>:0 
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.19

========== Clean: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Clean: 1 error, 0 warnings

Reproduction Link

See github URL above.

Workaround

Did you find any workaround for this issue? Not yet.

knocte commented 1 year ago

Sigh, unfortunately I cannot reproduce anymore. And this looks awfully similar to this: https://github.com/xamarin/xamarin-macios/issues/9670