xamarin-macios icon indicating copy to clipboard operation
xamarin-macios copied to clipboard

Xamarin.iOS: error MSB4018: The "ComputeCodesignItems" task failed unexpectedly.

Open suihanhbr opened this issue 3 years ago • 2 comments

Steps to Reproduce

Build Xamarin.iOS project and get the error .

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.Shared.targets(3,3): Error MSB4018: The "ComputeCodesignItems" task failed unexpectedly.
System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
  at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x00073] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/String.Manipulation.cs:1626 
  at System.String.Substring (System.Int32 startIndex) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/String.Manipulation.cs:1592 
  at Xamarin.MacDev.Tasks.ComputeCodesignItemsTaskBase.Execute () [0x00249] in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ComputeCodesignItemsTaskBase.cs:107 
  at Xamarin.MacDev.Tasks.ComputeCodesignItems.Execute () [0x0002a] in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs:15 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:578 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002b9] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:807  (MSB4018) (SuiHanIME.iOS)

I fail to create a new project which will occur the error. It only happen on my personal project.

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.0.7 (build 7)
Installation UUID: 4e60959a-758f-48ce-ae6d-26e15276ea83

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

Roslyn (Language Service)
4.1.0-3.22075.3+592501cbb9c9394072a245c15b3458ff88155d85

NuGet
Version: 6.0.0.262

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.302/Sdks
SDK Versions:
	6.0.302
	6.0.301
	6.0.300
	6.0.105
	6.0.104
	6.0.103
	6.0.102
	6.0.101
	6.0.100
	5.0.408
	5.0.407
	5.0.406
	5.0.405
	5.0.404
	5.0.403
	5.0.402
	5.0.400
	5.0.302
	5.0.301
	5.0.203
	5.0.202
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.421
	3.1.420
	3.1.419
	3.1.418
	3.1.417
	3.1.416
	3.1.415
	3.1.414
	3.1.412
	3.1.411
	3.1.410
	3.1.409
	3.1.408
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.403
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
	3.1.101
	3.1.100
	3.0.100
	3.0.100-preview5-011568
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	6.0.7
	6.0.6
	6.0.5
	6.0.4
	6.0.3
	6.0.2
	6.0.1
	6.0.0
	5.0.17
	5.0.16
	5.0.15
	5.0.14
	5.0.13
	5.0.12
	5.0.11
	5.0.9
	5.0.8
	5.0.7
	5.0.6
	5.0.5
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.27
	3.1.26
	3.1.25
	3.1.24
	3.1.23
	3.1.22
	3.1.21
	3.1.20
	3.1.18
	3.1.17
	3.1.16
	3.1.15
	3.1.14
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.9
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	3.1.1
	3.1.0
	3.0.0
	3.0.0-preview5-27626-15
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16
	2.1.15
	2.1.14
	2.1.13

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

Updater
Version: 11

Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100

Xamarin.Mac
Version: 8.10.0.5 (Visual Studio Community)
Hash: 96b3edb6d
Branch: d17-2
Build date: 2022-05-18 07:32:06-0400

Xamarin.iOS
Version: 15.10.0.5 (Visual Studio Community)
Hash: 96b3edb6d
Branch: d17-2
Build date: 2022-05-18 07:32:07-0400

Xamarin Designer
Version: 17.1.5.90
Hash: 53f47efde
Branch: remotes/origin/d17-0-vsmac
Build date: 2022-07-20 22:42:31 UTC

Xamarin.Android
Version: 12.3.3.3 (Visual Studio Community)
Commit: xamarin-android/d17-2/4e061b7
Android SDK: /Users/huangboru/myfile/sdk
	Supported Android versions:
		8.0  (API level 26)
		6.0  (API level 23)
		12.0 (API level 31)
		8.1  (API level 27)
		5.1  (API level 22)
		11.0 (API level 30)
		10.0 (API level 29)
		7.1  (API level 25)
		9.0  (API level 28)
		7.0  (API level 24)

SDK Command-line Tools Version: 5.0
SDK Platform Tools Version: 32.0.0
SDK Build Tools Version: 32.0.0 rc1

Build Information: 
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-2@9760f0a9
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.38.2@7b1e016
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-2@fc3c2ac

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.2.0.37
Hash: 7f5a6ef
Branch: remotes/origin/d17-2
Build date: 2022-07-20 22:42:36 UTC

Android Device Manager
Version: 0.0.0.1116
Hash: e47e6c8
Branch: remotes/origin/d17-2
Build date: 2022-07-20 22:42:36 UTC

Build Information
Release ID: 1700070007
Git revision: 5a924af5432fc0ed4adc294eb2edb6a95c97cf2e
Build date: 2022-07-20 22:40:26+00
Build branch: release-17.0
Build lane: release-17.0

Operating System
Mac OS X 12.3.1
Darwin 21.4.0 Darwin Kernel Version 21.4.0
    Fri Mar 18 00:45:05 PDT 2022
    root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64


Build Logs

build.log

suihanhbr avatar Aug 06 '22 09:08 suihanhbr

The log appears to have some characters corruption (possibly different character encoding):

ComputeCodesignItems"
    任务参数:

Is the machine in question setup with multiple languages support, if so which ones?

The fact that it is specific to one of your projects suggests that it is specific to a name, location, or project setting specific to it.

Without more information and a sample project, at best we're going to be guessing here.

chamons avatar Aug 08 '22 14:08 chamons

Hi @suihanhbr. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

msftbot[bot] avatar Aug 08 '22 14:08 msftbot[bot]

I cut my project ,create a small test project for this issue xamarin_workspace.zip

and I find it needs two conditions at least to occur the error.

  1. the length of path string. The origin path of my project is /Users/huangboru/myfile/xamarin_workspace/version4/version4.sln, when I change it to /Users/huangboru/myfile/xamarin_workspa/version4/version4.sln, it is fine.
  2. there is two soft link in my subproject SuiHanIME.iOS, obj and bin,they link to the virtual disk I create on ram. If I cancel they and rebuild SuiHanIME.iOS, it is fine.

suihanhbr avatar Aug 13 '22 16:08 suihanhbr

The length of the path would make some sense if you were building from Windows, as they have MAX_PATH to worry about, but I've not seen an issue of that nature on macOS before.

The virtual RAM disk angle seems to be the most promising, as I have never had a report using such a thing.

Does your issue reproduce when just you sync the project to a disk and not have any sym links to that drive?

chamons avatar Aug 24 '22 18:08 chamons

Hi @suihanhbr. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

msftbot[bot] avatar Aug 24 '22 18:08 msftbot[bot]

Hi @suihanhbr. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you.

msftbot[bot] avatar Aug 31 '22 19:08 msftbot[bot]

I am also having this problem, starting with VS 2022 on the Mac. If "bin" and "obj" are symlinks, I am getting this error. If I remove the symlinks and replace them with folders, no issues.

dtavlikos avatar Sep 29 '22 06:09 dtavlikos