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

[Xamarin.Build.Download] Using 7z to extract .tgz files can cause the build task to hang forever. #1047

Open
maonaoda opened this issue Nov 16, 2024 · 8 comments · May be fixed by #1048
Open

Comments

@maonaoda
Copy link

Android framework version

Other

Affected platform version

It should have started a long time ago.

Description

  1. Currently, I am using the latest VS2022 17.12.0, and when building an iOS application on Windows, the build task hangs forever.

  2. And through diagnostics, I had found that the process was stuck in the state of extracting GAppM-10.28.0.tgz.

1>ファイル "E:\DataFromC\NuGet\packages\xamarin.build.download\0.11.4\buildTransitive\Xamarin.Build.Download.targets" 内のターゲット "_XamarinBuildDownloadCore":
1>  TaskRun 中にアセンブリが読み込まれました: Xamarin.Build.Download, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (場所: E:\DataFromC\NuGet\packages\xamarin.build.download\0.11.4\buildTransitive\Xamarin.Build.Download.dll、MVID: 2e6281bd-9798-47ee-9ea8-82f214394218、AppDomain: [Default])
1>  "XamarinDownloadArchives" タスクをアセンブリ "E:\DataFromC\NuGet\packages\xamarin.build.download\0.11.4\buildTransitive\Xamarin.Build.Download.dll" から使用しています。
1>  タスク "XamarinDownloadArchives"
1>    E:\DataFromC\NuGet\packages\xamarin.build.download\0.11.4\buildTransitive\Xamarin.Build.Download.targets(56,4): message : D:\Program Files\7-Zip
1>    タスク パラメーター:User7ZipPath=D:\Program Files\7-Zip
1>    タスク パラメーター:IsAndroid=False
1>    タスク パラメーター:CacheDirectory=C:\Users\xxx\AppData\Local\XamarinBuildDownloadCache\
1>    タスク パラメーター:
1>        Archives=
1>            GAppM-10.28.0
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/firebase/ios/analytics/4d5ec9a36b6d4fd4/GoogleAppMeasurement-10.28.0.tar.gz
1>            MLKCommon-11.0.0
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/dl/cpdc/85bda285a1954024/MLKitCommon-11.0.0.tar.gz
1>            MLKVision-7.0.0
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/dl/cpdc/a82625c72bbef814/MLKitVision-7.0.0.tar.gz
1>            MLImage-1.0.0-beta5
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/dl/cpdc/10ddbf30d0514f6d/MLImage-1.0.0-beta5.tar.gz
1>            MLKImgLblCommon-7.0.0
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/dl/cpdc/32805ca33739d2ef/MLKitImageLabelingCommon-7.0.0.tar.gz
1>            MLKObjCommon-7.0.0
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/dl/cpdc/113871a79ef25131/MLKitObjectDetectionCommon-7.0.0.tar.gz
1>            MLKitBarcodeScanning-5.0.0
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/dl/cpdc/a0171fe6f0004baf/MLKitBarcodeScanning-5.0.0.tar.gz
1>            FCrshlytcs-10.29.0
1>                    Kind=Uncompressed
1>                    ToFile=C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\FCrshlytcs-10.29.0\upload-symbols.sh
1>                    Url=https://raw.githubusercontent.com/firebase/firebase-ios-sdk/eca84fd638116dd6adb633b5a3f31cc7befcbb7d/Crashlytics/upload-symbols
1>            FAnlytcs-10.28.0
1>                    Kind=Tgz
1>                    Url=https://dl.google.com/firebase/ios/analytics/83850700831975be/FirebaseAnalytics-10.28.0.tar.gz
1>    タスク パラメーター:VsInstallRoot=C:\Program Files\Microsoft Visual Studio\2022\Enterprise
1>    タスク パラメーター:AllowUnsecureUrls=False
1>    タスク パラメーター:DestinationBase=C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\
1>    TaskRun (Xamarin.Build.Download.XamarinDownloadArchives) 中にアセンブリが読み込まれました: Microsoft.Win32.Registry, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (場所: E:\DataFromC\NuGet\packages\xamarin.build.download\0.11.4\buildTransitive\Microsoft.Win32.Registry.dll、MVID: f165d2aa-905d-4dd4-8e4a-317d747f8224、AppDomain: [Default])
1>    Extracting C:\Users\xxx\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0.tgz to C:\Users\xxx\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0
  1. Once I kill the 14100 process, the next extraction will finally begin.

Image

1>    TaskRun (Xamarin.Build.Download.XamarinDownloadArchives) 中にアセンブリが読み込まれました: Microsoft.Win32.Registry, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (場所: E:\DataFromC\NuGet\packages\xamarin.build.download\0.11.4\buildTransitive\Microsoft.Win32.Registry.dll、MVID: f165d2aa-905d-4dd4-8e4a-317d747f8224、AppDomain: [Default])
1>    Extracting C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0.tgz to C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0
1>    E:\DataFromC\NuGet\packages\xamarin.build.download\0.11.4\buildTransitive\Xamarin.Build.Download.targets(51,3): error XBD002: Unpacking failed. Please download 'https://dl.google.com/firebase/ios/analytics/4d5ec9a36b6d4fd4/GoogleAppMeasurement-10.28.0.tar.gz' and extract it to the 'C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0' directory and create an empty file called 'C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0.unpacked'.
1>    Unpacking failure reason: 
1>    7-Zip 18.05 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
1>    
1>    Scanning the drive for archives:
1>    1 file, 10038515 bytes (9804 KiB)
1>    
1>    Extracting archive: C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0.tgz
1>    --
1>    Path = C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0.tgz
1>    Type = gzip
1>    Headers Size = 10
1>    
1>    
1>    Would you like to replace the existing file:
1>      Path:     C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\GAppM-10.28.0\GAppM-10.28.0.tar
1>      Size:     40711680 bytes (39 MiB)
1>      Modified: 2024-06-12 13:37:33
1>    with the file from archive:
1>      Path:     GAppM-10.28.0.tar
1>      Size:     40711680 bytes (39 MiB)
1>      Modified: 2024-06-12 13:37:33
1>    ? (Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit?
1>      Downloading https://dl.google.com/dl/cpdc/85bda285a1954024/MLKitCommon-11.0.0.tar.gz to C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\MLKCommon-11.0.0.tgz
1>    	(2272/2400715b), total 0.0%
1>    	(240320/2400715b), total 10.0%
1>    	(480928/2400715b), total 20.0%
1>    	(721056/2400715b), total 30.0%
1>    	(960480/2400715b), total 40.0%
1>    	(1212416/2400715b), total 50.0%
1>    	(1441792/2400715b), total 60.0%
1>    	(1687552/2400715b), total 70.0%
1>    	(1933312/2400715b), total 80.0%
1>    	(2162672/2400715b), total 90.0%
1>    	(2400715/2400715b), total 100.0%
1>      Downloading Complete
1>    Extracting C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\MLKCommon-11.0.0.tgz to C:\Users\wangyk\AppData\Local\XamarinBuildDownloadCache\MLKCommon-11.0.0

4.Look, what have we found? It wants us to agree to whether to overwrite.
? (Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit?
Obviously, the extraction has been waiting for a response.


So, the fix is quite simple.

Relevant log output

@VideoSystems
Copy link

For any stumbling across this issue, there's a manual workaround that allows me to build my project again:

  1. Navigate in Windows to the following directory: C:\Users[USER]\AppData\Local\XamarinBuildDownloadCache
  2. Look for GAppM-10.28.0.tgz and extract it. If it doesn't exist, you can download it from here: https://dl.google.com/firebase/ios/analytics/4d5ec9a36b6d4fd4/GoogleAppMeasurement-10.28.0.tar.gz. Make sure to extract it to the folder name "GAppM-10.28.0".
  3. You should see a file called "GAppM-8.9.1.unpacked" in the XamarinBuildDownloadCache directory. Make a copy of that and rename the file to "GAppM-10.28.0.unpacked".
  4. VS should now recognize that the folder now exists and shouldn't prompt for the Overwrite of the folder in the background, which was the cause of the build hang.

@TimothyFran
Copy link

Having this error while building MAUI .NET 9 for iOS.

Solved following workaround from previous message:

  • Manual extract GAppM-11.0.0
  • Create new file named GAppM-11.0.0.unpacked with content: This marks that the extraction completed successfully as the original one
  • Problem solved

@leonluc-dev
Copy link

leonluc-dev commented Mar 4, 2025

Seems to happen to any Google archive using the Xamarin.Build.Download.XamarinDownloadArchives process on Windows.

Happens with the Google Maps library as well (as used in this package): I had to extract the GMps-9.2.0.tgz file and create a GMps-9.2.0.unpacked file the same way as the other workarounds listed above.

@GODston
Copy link

GODston commented Mar 17, 2025

For any stumbling across this issue, there's a manual workaround that allows me to build my project again:

  1. Navigate in Windows to the following directory: C:\Users[USER]\AppData\Local\XamarinBuildDownloadCache
  2. Look for GAppM-10.28.0.tgz and extract it. If it doesn't exist, you can download it from here: https://dl.google.com/firebase/ios/analytics/4d5ec9a36b6d4fd4/GoogleAppMeasurement-10.28.0.tar.gz. Make sure to extract it to the folder name "GAppM-10.28.0".
  3. You should see a file called "GAppM-8.9.1.unpacked" in the XamarinBuildDownloadCache directory. Make a copy of that and rename the file to "GAppM-10.28.0.unpacked".
  4. VS should now recognize that the folder now exists and shouldn't prompt for the Overwrite of the folder in the background, which was the cause of the build hang.

I tried this solution and it first failed on the manual extract because of some priviliges.
I then tried running a 7zip.exe instance as admin to extract, which worked, but then when building the project VS would not get priviliges to acces the same files i had issues with extracting. The file seemed to be

C:\Users\***\AppData\Local\XamarinBuildDownloadCache\GAppM-11.0.0.tgz\GoogleAppMeasurement-11.0.0\Frameworks\GoogleAppMeasurement.xcframework\ios-arm64_x86_64-maccatalyst\GoogleAppMeasurement.framework\Modules

which is a .symlink file. I dont have experience with these files but i cant seem to enable acces to the file, when i righ click > properties > security, all my users (even the one im on rn, which should be admin) have full access and permissions, but it still denies me enty. I tried following the target path, as symlink seems to be some sort of shortcut type of file, and all files after the modules one i can access without permissions issues, its just the modules one that's getting me stuck.

Any solutions for this?

@burrowj
Copy link

burrowj commented Mar 27, 2025

This has been happening forever and been logged previously. Just never fixed. Using 7-Zip instead of 7z should fix the issue
If this can't be permenantly be made the fix, then allow the option to configure the zip tool to use for this process and allow users to configure it.

@burrowj
Copy link

burrowj commented Mar 28, 2025

I want share "workarounds" that worked for me

First, in case anyone is thinking I haven't seet long file names enables in windows, I have.

There are two issues

  1. The zip tool used can't hanlde long file names
  2. The copy tool uses can't handle long file names

Issues 1 leads to the issues mentioned here. Issue 2 leads to issues like those mentioned here
xamarin/GoogleApisForiOSComponents#649

Here is my work around which fixed these issues
(except for a google maps issue I had to do something similar too that @VideoSystems suggested)

In my project folder I put the following.

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
        <RestorePackagesPath>c:\pk</RestorePackagesPath>
	<IntermediateOutputPath>C:\Cache\$(MSBuildProjectName)\obj\</IntermediateOutputPath>
	<BaseOutputPath>C:\Cache\$(MSBuildProjectName)\out\</BaseOutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
        <RestorePackagesPath>c:\pk</RestorePackagesPath>
	<BaseOutputPath>../../../Cache\$(MSBuildProjectName)\out\</BaseOutputPath>
	<IntermediateOutputPath>../../../Cache\$(MSBuildProjectName)\obj\</IntermediateOutputPath>
</PropertyGroup>

@maonaoda
Copy link
Author

In my case, I am temporarily using
https://www.nuget.org/packages/Maonaoda.Xamarin.Build.Download/0.12.0
Of course, after the replacement, you may need to ensure that 7z.exe ends execution (you can manually close or restart the computer)

@burrowj
Copy link

burrowj commented Mar 28, 2025

In my case, I am temporarily using https://www.nuget.org/packages/Maonaoda.Xamarin.Build.Download/0.12.0 Of course, after the replacement, you may need to ensure that 7z.exe ends execution (you can manually close or restart the computer)

Ok thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants