xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.45k stars 511 forks source link

`System.IO.IOException: Sharing violation on path` executing `dotnet publish` when referencing package containing culture specific resource assemblies in subdirectories #13838

Closed lauxjpn closed 2 years ago

lauxjpn commented 2 years ago

Steps to Reproduce

I have a net6.0-ios targeting project, that references a package that contains culture specific resource assemblies (the package is a locally build Xamarin.Forms package, of which the iOS related parts target net6.0-ios).

I am running the following build command for my project on my Windows 10 development machine, to build the project remotely on my macOS build host:

dotnet publish "C:\PathToSolution\src\ProjectName\ProjectName.csproj" -c Release -p:ServerAddress=192.168.0.3 -p:ServerUser=username -bl -v d

This results in the following build errors:

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/sv/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ar/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/th/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ca/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/tr/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/cs/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/uk/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/da/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/vi/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/de/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/zh-HK/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/el/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/es/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/zh-Hans/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/fi/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/zh-Hant/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/fr/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/he/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/hi/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/hr/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/hu/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/it/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ja/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ko/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ms/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/nb/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/nl/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/pl/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/pt-BR/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/pt/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ro/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ru/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/sk/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj]

Looks to me, like the resource assemblies that are located in culture specific subdirectories on my Windows 10 development machine (e.g. .../ca/Xamarin.Forms.Platform.iOS.resources.dll) are all tried to be accessed on the macOS build host from the same directory (...\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll).

Expected Behavior

The Xamarin.MacDev.Tasks.ILStrip task in the _StripAssemblyIL target should run successfully.

Actual Behavior

A System.IO.IOException: Sharing violation on path /Users/username/...\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll exception is thrown for each culture specific resource assembly.

Environment

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100\

Build Logs

Relevant build log excerpt with --verbosity detailed ``` ILStrip: 2022-01-21T16:44:31.9130119+01:00 - Started ILStrip: 2022-01-21T16:44:31.9130805+01:00 - Initializing [xma]: Trying to get a Build Connection for Session 'c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d': Xamarin.Messaging.Build.Client.BuildConnection.c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d, Lifetime: Build ILStrip: 2022-01-21T16:44:31.9132159+01:00 - Initialized ILStrip: 2022-01-21T16:44:31.9138527+01:00 - There's no available inputs to copy to the Mac ILStrip: 2022-01-21T16:44:31.9138656+01:00 - Serializing intputs ILStrip: 2022-01-21T16:44:31.9303601+01:00 - Executing [xma]: Starting remote task execution for 'ProjectName': Xamarin.MacDev.Tasks.ILStrip [xma]: Sending Request Xamarin.Messaging.Build.Contracts.ExecuteTaskMessage to topic xvs/build/execute-task/ProjectName/c42c14e002fILStrip [xma]: Received Response of Xamarin.Messaging.Build.Contracts.ExecuteTaskMessage to topic buildc42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d22556Username/+/xvs/build/execute-task/ProjectName/c42c14e002fILStrip ILStrip: 2022-01-21T16:44:33.0852751+01:00 - Logging messages [ILStrip] C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/id/Xamarin.Forms.Platform.iOS.resources.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [ILStrip] C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ar/Xamarin.Forms.Platform.iOS.resources.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [ILStrip] C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/sv/Xamarin.Forms.Platform.iOS.resources.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [ILStrip] obj/Release/net6.0-ios/ios-arm64/linked/System.Collections.NonGeneric.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\System.Collections.NonGeneric.dll [ILStrip] obj/Release/net6.0-ios/ios-arm64/linked/Microsoft.AppCenter.Crashes.iOS.Bindings.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\Microsoft.AppCenter.Crashes.iOS.Bindings.dll [ILStrip] obj/Release/net6.0-ios/ios-arm64/linked/System.Runtime.Serialization.Primitives.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\System.Runtime.Serialization.Primitives.dll [ILStrip] obj/Release/net6.0-ios/ios-arm64/linked/System.Drawing.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\System.Drawing.dll [ILStrip] obj/Release/net6.0-ios/ios-arm64/linked/System.Net.Security.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\System.Net.Security.dll System.IO.IOException: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:91 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) at ILStrip+AssemblyStripper.StripAssembly (CilStrip.Mono.Cecil.AssemblyDefinition assembly, System.String file) [0x00000] in :0 at ILStrip.StripAssembly (Microsoft.Build.Framework.ITaskItem assemblyItem) [0x00065] in :0 System.IO.IOException: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:91 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) at ILStrip+AssemblyStripper.StripAssembly (CilStrip.Mono.Cecil.AssemblyDefinition assembly, System.String file) [0x00000] in :0 at ILStrip.StripAssembly (Microsoft.Build.Framework.ITaskItem assemblyItem) [0x00065] in :0 1:7>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/id/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj] 1:7>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/sv/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj] [ILStrip] C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/th/Xamarin.Forms.Platform.iOS.resources.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [ILStrip] C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/it/Xamarin.Forms.Platform.iOS.resources.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll System.IO.IOException: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:91 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) at ILStrip+AssemblyStripper.StripAssembly (CilStrip.Mono.Cecil.AssemblyDefinition assembly, System.String file) [0x00000] in :0 at ILStrip.StripAssembly (Microsoft.Build.Framework.ITaskItem assemblyItem) [0x00065] in :0 1:7>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.0.101-preview.11.551\targets\Xamarin.Shared.Sdk.targets(659,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/th/Xamarin.Forms.Platform.iOS.resources.dll: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll [C:\PathToSolution\src\ProjectName\ProjectName.csproj] [ILStrip] C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/tr/Xamarin.Forms.Platform.iOS.resources.dll to obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll System.IO.IOException: Sharing violation on path /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj\Release\net6.0-ios\ios-arm64\stripped\\Xamarin.Forms.Platform.iOS.resources.dll at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:91 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) at ILStrip+AssemblyStripper.StripAssembly (CilStrip.Mono.Cecil.AssemblyDefinition assembly, System.String file) [0x00000] in :0 at ILStrip.StripAssembly (Microsoft.Build.Framework.ITaskItem assemblyItem) [0x00065] in :0 [...] ```

If necessary, I could privately share a binlog, but the excerpt should already contain all the relevant information regarding this issue.

lauxjpn commented 2 years ago

I then temporarily removed the files to see whether the build would succeed:

<Target Name="AddStripAssemblyILFix" AfterTargets="_ComputeStripAssemblyIL" BeforeTargets="_StripAssemblyIL">
    <ItemGroup>
        <CultureSpecificResourceAssembly Include="@(ResolvedFileToPublish)"
                                         Condition="'%(Filename)%(Extension)' == 'Xamarin.Forms.Platform.iOS.resources.dll'" />
        <ResolvedFileToPublish Remove="@(ResolvedFileToPublish)"
                               Condition="'%(Filename)%(Extension)' == 'Xamarin.Forms.Platform.iOS.resources.dll'" />
    </ItemGroup>
</Target>
<Target Name="RemoveStripAssemblyILFix" AfterTargets="_StripAssemblyIL">
    <ItemGroup>
        <ResolvedFileToPublish Include="@(CultureSpecificResourceAssembly)" />
    </ItemGroup>
</Target>

It doesn't. I now get the following error cluster from the _CopyResolvedFilesToPublishPreserveNewest task:

C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\15.0.101-preview.11.551\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Microsoft.AppCenter.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\15.0.101-preview.11.551\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Microsoft.AppCenter.iOS.Bindings.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]

[...]

While the obj/Release/net6.0-ios/ios-arm64/stripped directory on my Windows 10 development machine contains the empty placeholder files (as expected), the /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/stripped directory itself on my macOS build host is empty (seems unexpected).

rolfbjarne commented 2 years ago

This looks like a duplicate of #13526, which has been fixed already.

Can you try to upgrade to preview 12 and see if that works for you?

lauxjpn commented 2 years ago

Can you try to upgrade to preview 12 and see if that works for you?

I am now using the 15.2.200-preview.12.3 iOS workload (from https://github.com/xamarin/xamarin-macios/commit/e49c11f99e6a75e01ca9b1f811e20ed99f5fa172#commitcomment-62961305) and dotnet 6.0.200-preview.22053.5 (as referenced in 618e68b: Version.Details.xml) on my Windows 10 development machine, and on the macOS build host (in both locations, /usr/local/shared/dotnet and /Users/username/Library/Caches/Xamarin/XMA/SDKs/dotnet).

The build fails now with the following error cluster from the _StripAssemblyIL target (with my previously posted targets disabled):

C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Sdk\15.2.200-preview.12.3\targets\Xamarin.Shared.Sdk.targets(691,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/id/Xamarin.Forms.Platform.iOS.resources.dll: File '/Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/id/Xamarin.Forms.Platform.iOS.resources.dll' not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Sdk\15.2.200-preview.12.3\targets\Xamarin.Shared.Sdk.targets(691,3): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/sv/Xamarin.Forms.Platform.iOS.resources.dll: File '/Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/sv/Xamarin.Forms.Platform.iOS.resources.dll' not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]

[...]

The source directory and all files exist on the Windows 10 development machine.

The following path does also exist on the macOS build host:

/Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10

Under this path on the macOS build host, the following files files are present at the time the error appears:

~ % ls -lah /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10
total 4272
drwxr-xr-x  6 username  staff   192B Jan 22 00:27 .
drwxr-xr-x  3 username  staff    96B Jan 22 00:27 ..
-rw-r--r--  1 username  staff   1.3M Jan 22 00:27 Xamarin.Forms.Core.dll
-rw-r--r--  1 username  staff    13K Jan 22 00:27 Xamarin.Forms.Platform.dll
-rw-r--r--  1 username  staff   701K Jan 22 00:27 Xamarin.Forms.Platform.iOS.dll
-rw-r--r--  1 username  staff   111K Jan 22 00:27 Xamarin.Forms.Xaml.dll

So some files have been copied/processed there, while the culture specific resource assemblies have not.


When I do enable the following target again to skip the culture specific resource assemblies ...

<Target Name="AddStripAssemblyILFix" AfterTargets="_ComputeStripAssemblyIL" BeforeTargets="_StripAssemblyIL">
    <ItemGroup>
        <CultureSpecificResourceAssembly Include="@(ResolvedFileToPublish)"
                                         Condition="'%(Filename)%(Extension)' == 'Xamarin.Forms.Platform.iOS.resources.dll'" />
        <ResolvedFileToPublish Remove="@(ResolvedFileToPublish)"
                               Condition="'%(Filename)%(Extension)' == 'Xamarin.Forms.Platform.iOS.resources.dll'" />
    </ItemGroup>
</Target>

... I now make it to the _AOTCompile target, that fails with errors like the following:

        Mono Ahead of Time compiler - compiling assembly /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/linked/Microsoft.AppCenter.iOS.Bindings.dll
        AOTID 5584B997-A787-9EA0-AF14-422EC9BC975D
        Could not load signature of ObjCRuntime.Trampolines+DMSACLogHandler:Invoke due to: Could not resolve type with token 01000014 from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') assembly:Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 type:System.nuint member:(null)
        Could not load signature of ObjCRuntime.Trampolines+DMSACLogHandler:BeginInvoke due to: Could not resolve type with token 01000014 from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') assembly:Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 type:System.nuint member:(null)
        Could not load signature of ObjCRuntime.Trampolines+SDMSACLogHandler:Invoke due to: Could not resolve type with token 01000014 from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') assembly:Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 type:System.nuint member:(null)
        Could not load signature of ObjCRuntime.Trampolines+DMSACLogHandler:Invoke due to: Could not resolve type with token 01000014 from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') assembly:Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 type:System.nuint member:(null)
        Could not load signature of ObjCRuntime.Trampolines+DMSACLogHandler:BeginInvoke due to: Could not resolve type with token 01000014 from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') assembly:Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 type:System.nuint member:(null)
        Could not load signature of ObjCRuntime.Trampolines+SDMSACLogHandler:Invoke due to: Could not resolve type with token 01000014 from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') assembly:Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 type:System.nuint member:(null)
        Could not load signature of ObjCRuntime.Trampolines+DMSACLogHandler:Invoke due to: Could not resolve type with token 01000014 from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') assembly:Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 type:System.nuint member:(null)

        Tool /Users/username/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.1/Sdk/../tools/mono-aot-cross execution started with arguments: --aot=mtriple=arm64-ios,data-outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Platform.aotdata,static,asmonly,direct-icalls,full,nodebug,dwarfdebug,llvm-path=/Users/username/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.1/Sdk/../tools,outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Platform.dll.s,llvm-outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Platform.dll.llvm.o --debug --llvm -O=gsharedvt /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/linked/Xamarin.Forms.Platform.dll

1:7>C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Sdk\15.2.200-preview.12.3\targets\Xamarin.Shared.Sdk.targets(936,3): error : Failed to AOT compile Microsoft.AppCenter.iOS.Bindings.dll, the AOT compiler exited with code 139 [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
        Tool /Users/username/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.1/Sdk/../tools/mono-aot-cross execution started with arguments: --aot=mtriple=arm64-ios,data-outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Platform.iOS.aotdata,static,asmonly,direct-icalls,full,nodebug,dwarfdebug,llvm-path=/Users/username/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.1/Sdk/../tools,outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Platform.iOS.dll.s,llvm-outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Platform.iOS.dll.llvm.o --debug --llvm -O=gsharedvt /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/linked/Xamarin.Forms.Platform.iOS.dll

        Tool /Users/username/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.1/Sdk/../tools/mono-aot-cross execution started with arguments: --aot=mtriple=arm64-ios,data-outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Xaml.aotdata,static,asmonly,direct-icalls,full,nodebug,dwarfdebug,llvm-path=/Users/username/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.1/Sdk/../tools,outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Xaml.dll.s,llvm-outfile=obj/Release/net6.0-ios/ios-arm64/nativelibraries/aot-output/arm64/Xamarin.Forms.Xaml.dll.llvm.o --debug --llvm -O=gsharedvt /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/linked/Xamarin.Forms.Xaml.dll

[...]

So I am now assuming that either the Microsoft.AppCenter.iOS.Bindings assembly is not compatible yet with the .NET 6 version of Xamarin.iOS, or something got liked/trimmed away.

However, this also happens for my locally build Xamarin.Forms.Platform.iOS.dll assembly, that targets net6.0-ios. I did not rebuild my local Xamarin.Forms repository after installing the 15.2.200-preview.12.3 iOS workload.


To check whether this latest issue has to do with using packages that have not been compiled against the 15.2.200-preview.12.3 iOS workload, I now tried to compile my local Xamarin.Forms repo (that already targets net6.0-ios) against 15.2.200-preview.12.3.

This now unexpectedly leads to compile time errors:

"E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.sln" (Build target) (1:2) ->
"E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj" (default target) (2:9) -> (CoreCompile target) -> E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\Extensions\Extensions.cs(18,14): error CS1061: 'IUITextInputTraits' does not contain a definition for 'AutocapitalizationType' and no accessible extension method 'AutocapitalizationType' accepting a first argument of type 'IUITextInputTraits' could be found (are you missing a using directive or an assembly reference?) [E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj]

[...]

  E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewLayout.cs(124,39): error CS1503: Argument 4: cannot convert from 'double' to 'ObjCRuntime.nfloat' [E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj]
  E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewLayout.cs(127,34): error CS1503: Argument 3: cannot convert from 'double' to 'ObjCRuntime.nfloat' [E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj]
  E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\Renderers\TabbedRenderer.cs(416,33): error CS1503: Argument 1: cannot convert from 'UIKit.UITextAttributes' to 'UIKit.UIStringAttributes' [E:\Sources\Xamarin.Forms.Net6\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj]

(The cannot convert from 'double' to 'ObjCRuntime.nfloat' errors are not the primary issue here, because they are easy to fix.)

Taking a look at the IUITextInputTraits interface, it appears to not contain any members, but only annotations:

Decompiled IUITextInputTraits code of 15.2.200-preview.12.3 ```c# using Foundation; using ObjCRuntime; using System; namespace UIKit { [Protocol(Name = "UITextInputTraits", WrapperType = typeof (UITextInputTraitsWrapper))] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "autocapitalizationType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "AutocapitalizationType", PropertyType = typeof (UITextAutocapitalizationType), Selector = "autocapitalizationType", SetterSelector = "setAutocapitalizationType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "autocorrectionType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "AutocorrectionType", PropertyType = typeof (UITextAutocorrectionType), Selector = "autocorrectionType", SetterSelector = "setAutocorrectionType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "keyboardType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "KeyboardType", PropertyType = typeof (UIKeyboardType), Selector = "keyboardType", SetterSelector = "setKeyboardType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "keyboardAppearance", IsProperty = true, IsRequired = false, IsStatic = false, Name = "KeyboardAppearance", PropertyType = typeof (UIKeyboardAppearance), Selector = "keyboardAppearance", SetterSelector = "setKeyboardAppearance:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "returnKeyType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "ReturnKeyType", PropertyType = typeof (UIReturnKeyType), Selector = "returnKeyType", SetterSelector = "setReturnKeyType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "enablesReturnKeyAutomatically", IsProperty = true, IsRequired = false, IsStatic = false, Name = "EnablesReturnKeyAutomatically", PropertyType = typeof (bool), Selector = "enablesReturnKeyAutomatically", SetterSelector = "setEnablesReturnKeyAutomatically:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "isSecureTextEntry", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SecureTextEntry", PropertyType = typeof (bool), Selector = "secureTextEntry", SetterSelector = "setSecureTextEntry:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "spellCheckingType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SpellCheckingType", PropertyType = typeof (UITextSpellCheckingType), Selector = "spellCheckingType", SetterSelector = "setSpellCheckingType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "textContentType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "TextContentType", PropertyType = typeof (NSString), Selector = "textContentType", SetterSelector = "setTextContentType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Assign, GetterSelector = "smartQuotesType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SmartQuotesType", PropertyType = typeof (UITextSmartQuotesType), Selector = "smartQuotesType", SetterSelector = "setSmartQuotesType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Assign, GetterSelector = "smartDashesType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SmartDashesType", PropertyType = typeof (UITextSmartDashesType), Selector = "smartDashesType", SetterSelector = "setSmartDashesType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Assign, GetterSelector = "smartInsertDeleteType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SmartInsertDeleteType", PropertyType = typeof (UITextSmartInsertDeleteType), Selector = "smartInsertDeleteType", SetterSelector = "setSmartInsertDeleteType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Copy, GetterSelector = "passwordRules", IsProperty = true, IsRequired = false, IsStatic = false, Name = "PasswordRules", PropertyType = typeof (UITextInputPasswordRules), Selector = "passwordRules", SetterSelector = "setPasswordRules:")] public interface IUITextInputTraits : INativeObject, IDisposable { } } ```

The interface correctly contains the expected members in the workload version I used previously:

Decompiled IUITextInputTraits code of 15.0.101-preview.11.551 ```c# using Foundation; using ObjCRuntime; using System; namespace UIKit { [Protocol(Name = "UITextInputTraits", WrapperType = typeof (UITextInputTraitsWrapper))] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "autocapitalizationType", IsProperty = true, IsRequired = true, IsStatic = false, Name = "AutocapitalizationType", PropertyType = typeof (UITextAutocapitalizationType), Selector = "autocapitalizationType", SetterSelector = "setAutocapitalizationType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "autocorrectionType", IsProperty = true, IsRequired = true, IsStatic = false, Name = "AutocorrectionType", PropertyType = typeof (UITextAutocorrectionType), Selector = "autocorrectionType", SetterSelector = "setAutocorrectionType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "keyboardType", IsProperty = true, IsRequired = true, IsStatic = false, Name = "KeyboardType", PropertyType = typeof (UIKeyboardType), Selector = "keyboardType", SetterSelector = "setKeyboardType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "keyboardAppearance", IsProperty = true, IsRequired = true, IsStatic = false, Name = "KeyboardAppearance", PropertyType = typeof (UIKeyboardAppearance), Selector = "keyboardAppearance", SetterSelector = "setKeyboardAppearance:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "returnKeyType", IsProperty = true, IsRequired = true, IsStatic = false, Name = "ReturnKeyType", PropertyType = typeof (UIReturnKeyType), Selector = "returnKeyType", SetterSelector = "setReturnKeyType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "enablesReturnKeyAutomatically", IsProperty = true, IsRequired = true, IsStatic = false, Name = "EnablesReturnKeyAutomatically", PropertyType = typeof (bool), Selector = "enablesReturnKeyAutomatically", SetterSelector = "setEnablesReturnKeyAutomatically:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "isSecureTextEntry", IsProperty = true, IsRequired = true, IsStatic = false, Name = "SecureTextEntry", PropertyType = typeof (bool), Selector = "secureTextEntry", SetterSelector = "setSecureTextEntry:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "spellCheckingType", IsProperty = true, IsRequired = true, IsStatic = false, Name = "SpellCheckingType", PropertyType = typeof (UITextSpellCheckingType), Selector = "spellCheckingType", SetterSelector = "setSpellCheckingType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.None, GetterSelector = "textContentType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "TextContentType", PropertyType = typeof (NSString), Selector = "textContentType", SetterSelector = "setTextContentType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Assign, GetterSelector = "smartQuotesType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SmartQuotesType", PropertyType = typeof (UITextSmartQuotesType), Selector = "smartQuotesType", SetterSelector = "setSmartQuotesType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Assign, GetterSelector = "smartDashesType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SmartDashesType", PropertyType = typeof (UITextSmartDashesType), Selector = "smartDashesType", SetterSelector = "setSmartDashesType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Assign, GetterSelector = "smartInsertDeleteType", IsProperty = true, IsRequired = false, IsStatic = false, Name = "SmartInsertDeleteType", PropertyType = typeof (UITextSmartInsertDeleteType), Selector = "smartInsertDeleteType", SetterSelector = "setSmartInsertDeleteType:")] [ProtocolMember(ArgumentSemantic = ArgumentSemantic.Copy, GetterSelector = "passwordRules", IsProperty = true, IsRequired = false, IsStatic = false, Name = "PasswordRules", PropertyType = typeof (UITextInputPasswordRules), Selector = "passwordRules", SetterSelector = "setPasswordRules:")] public interface IUITextInputTraits : INativeObject, IDisposable { [Preserve(Conditional = true)] UITextAutocapitalizationType AutocapitalizationType { [Export("autocapitalizationType")] get; [Export("setAutocapitalizationType:")] set; } [Preserve(Conditional = true)] UITextAutocorrectionType AutocorrectionType { [Export("autocorrectionType")] get; [Export("setAutocorrectionType:")] set; } [Preserve(Conditional = true)] UIKeyboardType KeyboardType { [Export("keyboardType")] get; [Export("setKeyboardType:")] set; } [Preserve(Conditional = true)] UIKeyboardAppearance KeyboardAppearance { [Export("keyboardAppearance")] get; [Export("setKeyboardAppearance:")] set; } [Preserve(Conditional = true)] UIReturnKeyType ReturnKeyType { [Export("returnKeyType")] get; [Export("setReturnKeyType:")] set; } [Preserve(Conditional = true)] bool EnablesReturnKeyAutomatically { [Export("enablesReturnKeyAutomatically")] get; [Export("setEnablesReturnKeyAutomatically:")] set; } [Preserve(Conditional = true)] bool SecureTextEntry { [Export("isSecureTextEntry")] get; [Export("setSecureTextEntry:")] set; } [Preserve(Conditional = true)] UITextSpellCheckingType SpellCheckingType { [Export("spellCheckingType")] get; [Export("setSpellCheckingType:")] set; } } } ```

The members are also missing in 15.2.300-preview.13.27.


Looks like major breaking changes were performed with #13012. So I guess the System.nuint errors are expected and all libraries using Xamarin.iOS now have to be recompiled.

Since I cannot officially recompile the AppCenter packages, because they are not open source, I would now have to disable AppCenter diagnostics in my iOS app, which is a bad idea in itself and also because it uses a prerelease of Xamarin.iOS. But even if I did, I could still not recompile Xamarin.Forms against a recent iOS workload, because of the missing IUITextInputTraits interface members.

And all of this, just to get an iOS release build of my app published (it all works fine when running as a Debug build in the simulator).

As it currently looks like, my only approach left (except building my own Xamarin.iOS version, which I really don't want to do) is probably to compile my app and its packages against the 15.0.101-preview.11.551 version as before, but use the 15.2.200-preview.12.3 SDK version for building. Which seems unnecessarily complicated.

mandel-macaque commented 2 years ago

@dalexsoto please take al look at @lauxjpn comment:

Since I cannot officially recompile the AppCenter packages, because they are not open source, I would now have to disable AppCenter diagnostics in my iOS app, which is a bad idea in itself and also because it uses a prerelease of Xamarin.iOS.

rolfbjarne commented 2 years ago

Looks like major breaking changes were performed with #13012. So I guess the System.nuint errors are expected and all libraries using Xamarin.iOS now have to be recompiled.

Correct.

Those breaking changes (and many others) are also causing all the other problems you're having.

But even if I did, I could still not recompile Xamarin.Forms against a recent iOS workload, because of the missing IUITextInputTraits interface members.

That's because of this: https://github.com/xamarin/xamarin-macios/pull/13607.

The fix is to add this change the class to do this (and not implement the corresponding interface member):

[Export ("autocapitalizationType")]
UITextAutocapitalizationType AutocapitalizationType { get { ... } ; set { ... }; }

As it currently looks like, my only approach left

The other option is to use an old-style Xamarin.iOS project, which is what we support right now (and will be supported for a while yet).

Once our .NET work is released, we won't do any breaking changes anymore (like we haven't in Xamarin for many, many years unless there were really exceptional circumstances), and these problems will go away. Until then, there will be a few speedbumps like these (which we're sorry for, but we believe we will be in a better place long-term).

lauxjpn commented 2 years ago

That's because of this: #13607.

The fix is to add this change the class to do this (and not implement the corresponding interface member):

[Export ("autocapitalizationType")]
UITextAutocapitalizationType AutocapitalizationType { get { ... } ; set { ... }; }

In case of Xamarin.Forms, IUITextInputTraits isn't actually implemented. It is just used as as type/contract in method calls, so that the called method can use the IUITextInputTraits reference to then use its AutocapitalizationType property.

@rolfbjarne What is the recommended approach for using the AutocapitalizationType property, given an IUITextInputTraits reference? The only thing that currently comes to my mind is reflection, but I am anticipating issues in regards to linking/trimming and AOT. So I would prefer a design-time approach that is surviving all of this.


Until then, there will be a few speedbumps like these (which we're sorry for, but we believe we will be in a better place long-term).

That is fine and expected. :smile: I am just providing feedback about the current state of the previews in regards to real-world-apps. No worries!

rolfbjarne commented 2 years ago

@rolfbjarne What is the recommended approach for using the AutocapitalizationType property, given an IUITextInputTraits reference?

There are GetAutocapitalizationType and SetAutocapitalizationType extension methods that can be used to access the autocapitalizationType selector (in the UIKit.UITextInputTraits_Extensions class, so you'll have to using UIKit;)

lauxjpn commented 2 years ago

There are GetAutocapitalizationType and SetAutocapitalizationType extension methods that can be used to access the autocapitalizationType selector (in the UIKit.UITextInputTraits_Extensions class, so you'll have to using UIKit;)

Thanks, somehow missed that!

lauxjpn commented 2 years ago

Issue/Erros with 15.2.100-preview.12.5 iOS workload

@rolfbjarne Referencing the 15.2.100-preview.12.5 iOS workload and also using it as SDK for building (on both, the Windows 10 development machine and the macOS build host) and using .NET 6.0.200-preview.22053.5, after fixing and recompiling Xamarin.Forms and removing the AppCenter code and references, I then got the following error cluster when executing dotnet build -c Release:

C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Newtonsoft.Json.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Xamarin.Essentials.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Xamarin.Forms.Platform.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Xamarin.Forms.Platform.iOS.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Xamarin.Forms.Xaml.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/System.ComponentModel.Primitives.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/System.ComponentModel.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/System.Drawing.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]

[...]

C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/System.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/mscorlib.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/netstandard.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/System.Private.CoreLib.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]
C:\PathToSolution\.dotnet\packs\Microsoft.iOS.Windows.Sdk\15.2.100-preview.12.5\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(260,3): error MSB3030: Could not copy the file "obj/Release/net6.0-ios/ios-arm64//stripped/Xamarin.iOS.dll" because it was not found. [C:\PathToSolution\src\ProjectName\ProjectName.csproj]

While the empty file stubs existed on the Windows 10 development machine at C:\PathToSolution\src\ProjectName\obj\Release\net6.0-ios\ios-arm64\stripped (expected):

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        26.01.2022     22:31                Microsoft.CSharp.dllProjects
d-----        26.01.2022     22:31                Microsoft.Win32.Primitives.dllProjects
d-----        26.01.2022     22:31                mscorlib.dllProjects
d-----        26.01.2022     22:31                netstandard.dllProjects
d-----        26.01.2022     22:31                Newtonsoft.Json.dllProjects
d-----        26.01.2022     22:31                System.Collections.Concurrent.dllProjects
d-----        26.01.2022     22:31                System.Collections.dllProjects
d-----        26.01.2022     22:31                System.Collections.NonGeneric.dllProjects
d-----        26.01.2022     22:31                System.Collections.Specialized.dllProjects

[...]

All of the files on the macOS build host were directly located at /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d (unexpected):

~ % ls -lah /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/
total 76488
drwxr-xr-x  153 username  staff   4.8K Jan 26 22:32 .
drwxr-xr-x    3 username  staff    96B Jan 26 22:32 ..
drwxr-xr-x   21 username  staff   672B Jan 26 22:32 Assets.xcassets
drwxr-xr-x    3 username  staff    96B Jan 26 22:32 C:
drwxr-xr-x    3 username  staff    96B Jan 26 22:32 E:
-rw-r--r--    1 username  staff   196B Jan 26 22:32 Entitlements.plist
drwxr-xr-x    3 username  staff    96B Jan 26 22:32 Resources
-rw-r--r--    1 username  staff    63B Jan 26 22:32 Roots.xml
drwxr-xr-x    4 username  staff   128B Jan 26 22:32 bin
drwxr-xr-x    4 username  staff   128B Jan 26 22:32 obj
-rw-r--r--    1 username  staff   123K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Microsoft.CSharp.dll
-rw-r--r--    1 username  staff   6.0K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Microsoft.Win32.Primitives.dll
-rw-r--r--    1 username  staff   396K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Newtonsoft.Json.dll
-rw-r--r--    1 username  staff    19K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Collections.Concurrent.dll
-rw-r--r--    1 username  staff    13K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Collections.NonGeneric.dll
-rw-r--r--    1 username  staff   8.0K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Collections.Specialized.dll
-rw-r--r--    1 username  staff    25K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Collections.dll
-rw-r--r--    1 username  staff   9.5K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.ComponentModel.Primitives.dll
-rw-r--r--    1 username  staff    68K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.ComponentModel.TypeConverter.dll
-rw-r--r--    1 username  staff   4.5K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.ComponentModel.dll
-rw-r--r--    1 username  staff   8.5K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Console.dll
-rw-r--r--    1 username  staff   4.0K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Core.dll
-rw-r--r--    1 username  staff   221K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Data.Common.dll
-rw-r--r--    1 username  staff   5.5K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Diagnostics.DiagnosticSource.dll
-rw-r--r--    1 username  staff    13K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Diagnostics.Process.dll
-rw-r--r--    1 username  staff    14K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Diagnostics.TraceSource.dll
-rw-r--r--    1 username  staff    27K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Drawing.Primitives.dll
-rw-r--r--    1 username  staff   4.5K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\System.Drawing.dll

[...]

-rw-r--r--    1 username  staff   123K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Xamarin.Essentials.dll
-rw-r--r--    1 username  staff   789K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Xamarin.Forms.Core.dll
-rw-r--r--    1 username  staff    12K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Xamarin.Forms.Platform.dll
-rw-r--r--    1 username  staff   370K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Xamarin.Forms.Platform.iOS.dll
-rw-r--r--    1 username  staff    67K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Xamarin.Forms.Xaml.dll
-rw-r--r--    1 username  staff    12M Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\Xamarin.iOS.dll
-rw-r--r--    1 username  staff   7.5K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\mscorlib.dll
-rw-r--r--    1 username  staff    18K Jan 26 22:32 obj\Release\net6.0-ios\ios-arm64\\stripped\netstandard.dll

As can be seen, the files had a name that was exactly what the relative path of the items should have been. So it appears that the files are wrongly named and are put in the wrong location by _StripAssemblyIL.

Workaround/Fix

I then applied the following workaround/fix, effectively replacing the original _StripAssemblyIL target:

<Target Name="After_ComputeStripAssemblyIL__Before_FixedStripAssemblyIL"
        Condition="'$(EnableAssemblyILStripping)' == 'true'"
        AfterTargets="_ComputeStripAssemblyIL"
        BeforeTargets="_StripAssemblyIL">
    <!-- Ensure that the real/broken _StripAssemblyIL target is not going to run, because we replace it
         with this target. -->
    <PropertyGroup>
        <EnableAssemblyILStripping>false</EnableAssemblyILStripping>
    </PropertyGroup>
    <!-- ^^^ -->

    <PropertyGroup>
        <_StrippedAssemblyDirectory>$(DeviceSpecificIntermediateOutputPath)\stripped</_StrippedAssemblyDirectory>
    </PropertyGroup>
    <ItemGroup>
        <!-- WORKAROUND: Ignore culture specific resource assemblies in subdirectories. -->
        <CultureSpecificResourceAssembly Include="@(ResolvedFileToPublish)" Condition="'%(Filename)%(Extension)' == 'Xamarin.Forms.Platform.iOS.resources.dll'" />
        <ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" Condition="'%(Filename)%(Extension)' == 'Xamarin.Forms.Platform.iOS.resources.dll'" />
        <!-- ^^^ -->

        <_AssembliesToBeStripped Include="@(ResolvedFileToPublish)" Condition="'%(Extension)' == '.dll'">
            <OutputPath Condition="'%(ResolvedFileToPublish.DestinationSubPath)' != ''">$(_StrippedAssemblyDirectory)\%(ResolvedFileToPublish.DestinationSubPath)</OutputPath>
            <OutputPath Condition="'%(ResolvedFileToPublish.DestinationSubPath)' == ''">$(_StrippedAssemblyDirectory)\%(Filename)%(Extension)</OutputPath>
        </_AssembliesToBeStripped>

        <!-- FIX: Use forward slashes in OutputPath, otherwise ILStrip will create filenames that resemble the part of
                  the relative path of the item that uses backslashes, instead of writing the file to the location of the
                  relative path. -->
        <_AssembliesToBeStripped>
            <OutputPath>$([System.String]::Copy('%(OutputPath)').Replace('\', '/'))</OutputPath>
        </_AssembliesToBeStripped>
        <!-- ^^^ -->

        <_AssemblyDirsToCreate Include="@(_AssembliesToBeStripped->'%(OutputPath)%(Directory)'->Distinct())"/>
    </ItemGroup>
    <MakeDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="@(_AssemblyDirsToCreate)" />
    <Xamarin.MacDev.Tasks.ILStrip Assemblies="@(_AssembliesToBeStripped)" SessionId="$(BuildSessionId)">
        <Output TaskParameter="StrippedAssemblies" ItemName="_StrippedAssemblies" />
    </Xamarin.MacDev.Tasks.ILStrip>
    <ItemGroup>
        <ResolvedFileToPublish Remove="@(_AssembliesToBeStripped)" />
        <ResolvedFileToPublish Include="@(_StrippedAssemblies)" />
    </ItemGroup>
</Target>

Now the files are being stripped and placed correctly in /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/stripped.

The \ occurences of OutputPath had to be replaced with /, and of course my previous workaround to skip the culture specific resource assemblies in subdirectories had to be applied as well.

/cc @praeclarum

rolfbjarne commented 2 years ago

@lauxjpn great detective work!

MSBuild is supposed to fix the path separators (\ -> /), but I also ran into a case where it didn't work some time ago with relative paths, so it seems MSBuild sometimes falls through :/

In any case I've created a pull request with your fix: #13919.

my previous workaround to skip the culture specific resource assemblies in subdirectories had to be applied as well

That should have been fixed here: https://github.com/xamarin/xamarin-macios/commit/4cf12e36232f969fbf6e1c641f138728fe10c1a1.

Do you know what the DestinationSubPath metadata is for the resource assemblies in your case?

lauxjpn commented 2 years ago

In any case I've created a pull request with your fix: #13919.

@rolfbjarne Thanks!

Do you know what the DestinationSubPath metadata is for the resource assemblies in your case?

The error message is:

C:\PathToSolution\src\ProjectName\ProjectName.csproj(93,9): error : ILStrip failed for C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ru/Xamarin.Forms.Platform.iOS.resources.dll: File '/Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ru/Xamarin.Forms.Platform.iOS.resources.dll' not found.

At the macOS build host, the following files exist:

~ % ls -lah /Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/C:/Users/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10
total 4272
drwxr-xr-x  6 username  staff   192B Jan 27 00:15 .
drwxr-xr-x  3 username  staff    96B Jan 27 00:15 ..
-rw-r--r--  1 username  staff   1.3M Jan 27 00:15 Xamarin.Forms.Core.dll
-rw-r--r--  1 username  staff    13K Jan 27 00:15 Xamarin.Forms.Platform.dll
-rw-r--r--  1 username  staff   701K Jan 27 00:15 Xamarin.Forms.Platform.iOS.dll
-rw-r--r--  1 username  staff   111K Jan 27 00:15 Xamarin.Forms.Xaml.dll

The following 2 (sample) directories exist on the macOS build host as well, but contain no files:

/Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/stripped/ar
/Users/username/Library/Caches/Xamarin/mtbs/builds/ProjectName/c42c14ed284fb2fb3c932a4cc8d9e9afc0f6d0aaeb390b848220a469cd12041d/obj/Release/net6.0-ios/ios-arm64/stripped/ar/Xamarin.Forms.Platform.iOS.resources.dllUsers/Username/.nuget/packages/xamarin.forms/6.0.0/lib/Xamarin.iOS10/ar

A sample Xamarin.Forms resource assembly item looks like this:

C:\Users\Username\.nuget\packages\xamarin.forms\6.0.0\lib\Xamarin.iOS10\ar\Xamarin.Forms.Platform.iOS.resources.dll
    DestinationSubPath = ar\Xamarin.Forms.Platform.iOS.resources.dll
    RelativePath = ..\ProjectName.app\\\ar\\Xamarin.Forms.Platform.iOS.resources.dll
    NuGetPackageVersion = 6.0.0
    AssetType = resources
    Culture = ar
    NuGetPackageId = Xamarin.Forms
    OutputPath = obj\Release\net6.0-ios\ios-arm64\\stripped\ar\Xamarin.Forms.Platform.iOS.resources.dll
    CopyLocal = true
    DestinationSubDirectory = ar\
    CopyToPublishDirectory = PreserveNewest
    PathInPackage = lib/Xamarin.iOS10/ar/Xamarin.Forms.Platform.iOS.resources.dll

The major upload operations for assemblies happen in the PrepareForBuild target for _UnpackLibraryResources items and in the _RunILLink target. In both targets, the Xamarin.Forms.Platform.iOS.resources.dll files are not being uploaded to the macOS build host (no error or warning).

The last time the Xamarin.Forms.Platform.iOS.resources.dll files were locally copied on the Windows 10 development machines was in the _CopyFilesMarkedCopyLocal target, shortly after the CoreCompile target.

rolfbjarne commented 2 years ago

@lauxjpn I've created #13922 for this other issue (to avoid having more than one bug per issue, which leaves everybody confused), and copied parts of your description and explanations there.

lauxjpn commented 2 years ago

There is still the open issue that the AppCenter package is not compatible with the current preview versions of Xamarin.iOS:

@dalexsoto please take al look at @lauxjpn comment:

Since I cannot officially recompile the AppCenter packages, because they are not open source, I would now have to disable AppCenter diagnostics in my iOS app, which is a bad idea in itself and also because it uses a prerelease of Xamarin.iOS.


@rolfbjarne It seems that net6.0-ios builds do not generate dSYM symbols. What is the recommended approach for generating them?

I am currently using the following workaround:

<Target Name="PrepareGenerateDSymFiles"
        AfterTargets="_PrepareDebugSymbolGeneration"
        BeforeTargets="_GenerateDebugSymbols">
    <ItemGroup>
        <_AppExtensionDebugSymbolProperties>
            <NoDSymUtil>true</NoDSymUtil>
            <NoSymbolStrip>true</NoSymbolStrip>
        </_AppExtensionDebugSymbolProperties>
    </ItemGroup>
</Target>

<Target Name="GenerateDSymFiles"
        AfterTargets="_CopyAppExtensionsToBundle"
        DependsOnTargets="_GetNativeExecutableName;
                          _PrepareDebugSymbolGeneration;
                          PrepareGenerateDSymFiles;
                          _GenerateDebugSymbols">
</Target>
rolfbjarne commented 2 years ago

There is still the open issue that the AppCenter package is not compatible with the current preview versions of Xamarin.iOS:

@dalexsoto please take al look at @lauxjpn comment:

Since I cannot officially recompile the AppCenter packages, because they are not open source, I would now have to disable AppCenter diagnostics in my iOS app, which is a bad idea in itself and also because it uses a prerelease of Xamarin.iOS.

@rolfbjarne It seems that net6.0-ios builds do not generate dSYM symbols. What is the recommended approach for generating them?

I am currently using the following workaround:

<Target Name="PrepareGenerateDSymFiles"
        AfterTargets="_PrepareDebugSymbolGeneration"
        BeforeTargets="_GenerateDebugSymbols">
    <ItemGroup>
        <_AppExtensionDebugSymbolProperties>
            <NoDSymUtil>true</NoDSymUtil>
            <NoSymbolStrip>true</NoSymbolStrip>
        </_AppExtensionDebugSymbolProperties>
    </ItemGroup>
</Target>

<Target Name="GenerateDSymFiles"
        AfterTargets="_CopyAppExtensionsToBundle"
        DependsOnTargets="_GetNativeExecutableName;
                          _PrepareDebugSymbolGeneration;
                          PrepareGenerateDSymFiles;
                          _GenerateDebugSymbols">
</Target>

I've filed https://github.com/xamarin/xamarin-macios/issues/14067 for us to have a look at this.