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

Missing app icon when building from symlink location on Mac #20330

Closed
awattar opened this issue Mar 19, 2024 · 1 comment · Fixed by #20364
Closed

Missing app icon when building from symlink location on Mac #20330

awattar opened this issue Mar 19, 2024 · 1 comment · Fixed by #20364
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@awattar
Copy link

awattar commented Mar 19, 2024

Steps to Reproduce

  1. Create project (MS.iOS, MS.Maui) with app icon set. Build from symlink location like /var (/private/var) - default location for Jenkins on Mac OS (JENKINS_HOME=/var/lib/jenkins or JENKINS_HOME=/var/jenkins_home).
  2. Archive for Publishing (IPA) or build with BuildIpa set to true.
  3. Observe that app is using default app icon (https://i.stack.imgur.com/PagNX.png).

Expected Behavior

App is using icon that was specified in the project.

Actual Behavior

Default app icon is being used.

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.6.9 (build 415)
Installation UUID: 119f10d8-f284-4df5-bfdc-43f715d9217b

Runtime
.NET 7.0.3 (64-bit)
Architecture: Arm64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/8.0.201/Sdks
SDK Versions:
	8.0.201
	8.0.101
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	8.0.2
	8.0.1

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

Updater
Version: 11

Apple Developer Tools
Xcode: 15.2 22503
Build: 15C500b

Xamarin.Mac
Version: 9.3.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:14:59-0400

Xamarin.iOS
Version: 16.4.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:15:00-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2024-02-07 03:23:12 UTC

Xamarin.Android
Version: 13.2.2.0 (Visual Studio Community)
Commit: xamarin-android/d17-5/45b0e14
Android SDK: /Users/user/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		12.0 (API level 31)
		13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 34.0.5
SDK Build Tools Version: 34.0.0

Build Information: 
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite/3.40.1@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.16.1
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.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2024-02-07 03:23:18 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2024-02-07 03:23:18 UTC

Build Information
Release ID: 1706090415
Git revision: 644e158287aa6bbbc40a95c98ef54d01fda30cb5
Build date: 2024-02-07 03:21:33+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 14.4.0
Darwin 23.4.0 Darwin Kernel Version 23.4.0
    Wed Feb 21 21:44:43 PST 2024
    root:xnu-10063.101.15~2/RELEASE_ARM64_T6000 arm64


Build Logs

Diagnostic build (xcrun with actool arg):
It mixes '/private/var/...' with '/var/..' for output-files entries.

...
Tool /usr/bin/xcrun execution started with arguments: actool --errors --warnings --notices --output-format xml1 --output-partial-info-plist /private/var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/partial-info.plist --app-icon AppIcon --compress-pngs --target-device iphone --target-device ipad --minimum-deployment-target 16.0 --platform iphoneos --compile /private/var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle /private/var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/cloned-assets/Resources/Images.xcassets
[2024-03-14T12:49:27.240Z]                               (TaskId:27)
[2024-03-14T12:49:27.240Z]                      Assembly loaded during TaskRun (Xamarin.MacDev.Tasks.ACTool): System.Collections.Specialized, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /Users/user/.dotnet/shared/Microsoft.NETCore.App/8.0.2/System.Collections.Specialized.dll, MVID: beb33b28-31c6-49b6-addc-268bc61e6f38, AssemblyLoadContext: Default) (TaskId:27)
[2024-03-14T12:49:27.240Z]                      Assembly loaded during TaskRun (Xamarin.MacDev.Tasks.ACTool): System.IO.Pipes, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /Users/user/.dotnet/shared/Microsoft.NETCore.App/8.0.2/System.IO.Pipes.dll, MVID: 0af03212-7606-4b0d-abdc-da8a0e3709bf, AssemblyLoadContext: Default) (TaskId:27)
[2024-03-14T12:49:27.240Z]                      Assembly loaded during TaskRun (Xamarin.MacDev.Tasks.ACTool): System.Net.Sockets, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /Users/user/.dotnet/shared/Microsoft.NETCore.App/8.0.2/System.Net.Sockets.dll, MVID: ac2d2079-5509-4b78-acaf-0bd37a9cfa67, AssemblyLoadContext: Default) (TaskId:27)
[2024-03-14T12:49:32.741Z]                      Tool /usr/bin/xcrun execution finished (exit code = 0).
[2024-03-14T12:49:32.742Z]                               (TaskId:27)
[2024-03-14T12:49:32.742Z]                      <?xml version="1.0" encoding="UTF-8"?>
[2024-03-14T12:49:32.742Z]                      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
[2024-03-14T12:49:32.742Z]                      <plist version="1.0">
[2024-03-14T12:49:32.742Z]                      <dict>
[2024-03-14T12:49:32.742Z]                      	<key>com.apple.actool.compilation-results</key>
[2024-03-14T12:49:32.742Z]                      	<dict>
[2024-03-14T12:49:32.742Z]                      		<key>output-files</key>
[2024-03-14T12:49:32.742Z]                      		<array>
[2024-03-14T12:49:32.742Z]                      			<string>/private/var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/partial-info.plist</string>
[2024-03-14T12:49:32.742Z]                      			<string>/var/lib/Jenkins/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png</string>
[2024-03-14T12:49:32.742Z]                      			<string>/var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png</string>
[2024-03-14T12:49:32.742Z]                      			<string>/var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car</string>
[2024-03-14T12:49:32.742Z]                      		</array>
[2024-03-14T12:49:32.742Z]                      	</dict>
...

It tries to resolve relative LogicalName paths but fails somehow on the symlink (/var) and creates some awkward looking entry:

...
Output Item(s): 
[2024-03-14T12:49:32.742Z]                          _BundleResourceWithLogicalName=
[2024-03-14T12:49:32.742Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-14T12:49:32.742Z]                                      LogicalName=../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-14T12:49:32.742Z]                                      Optimize=false
[2024-03-14T12:49:32.742Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-14T12:49:32.742Z]                                      LogicalName=../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-14T12:49:32.742Z]                                      Optimize=false
[2024-03-14T12:49:32.742Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
[2024-03-14T12:49:32.742Z]                                      LogicalName=../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
[2024-03-14T12:49:32.742Z]                                      Optimize=false (TaskId:27)
[2024-03-14T12:49:32.742Z]                      Output Item(s): _ACTool_PartialAppManifest=obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/partial-info.plist (TaskId:27)
...

Then it tries to feed OutputPaths with these paths that seems to be treated as a location outside app bundle - as it is not directly from the underlaying bundle but many levels up the file tree:

...
[2024-03-14T12:49:37.988Z]                      Output Item(s): 
[2024-03-14T12:49:37.988Z]                          _BundleResourceWithOutputPath=
[2024-03-14T12:49:37.988Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-14T12:49:37.988Z]                                      LogicalName=../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-14T12:49:37.988Z]                                      Optimize=false
[2024-03-14T12:49:37.988Z]                                      OriginalItemSpec=obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-14T12:49:37.988Z]                                      OutputPath=bin/iPhone/Release/net8.0-ios17.0/ios-arm64/App.app/../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-14T12:49:37.988Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-14T12:49:37.988Z]                                      LogicalName=../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-14T12:49:37.988Z]                                      Optimize=false
[2024-03-14T12:49:37.988Z]                                      OriginalItemSpec=obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-14T12:49:37.988Z]                                      OutputPath=bin/iPhone/Release/net8.0-ios17.0/ios-arm64/App.app/../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/Appr/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-14T12:49:37.988Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
[2024-03-14T12:49:37.988Z]                                      LogicalName=../../../../../../../../../../../../../../../../../var/lib/Jenkins/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
[2024-03-14T12:49:37.988Z]                                      Optimize=false
[2024-03-14T12:49:37.988Z]                                      OriginalItemSpec=obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
[2024-03-14T12:49:37.988Z]                                      OutputPath=bin/iPhone/Release/net8.0-ios17.0/ios-arm64/App.app/../../../../../../../../../../../../../../../../../var/lib/Jenkins/workspace/ws/App/obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
...

It seems that resolve algorithm does not play well with symlinks and for some reason is going further in the tree level trying to unwind the link.

In working build (no symlink involved) bundle resources are referenced directly from the App.app:

...
[2024-03-18T12:26:18.008Z]                      Output Item(s): 
[2024-03-18T12:26:18.008Z]                          _BundleResourceWithOutputPath=
[2024-03-18T12:26:18.008Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-18T12:26:18.008Z]                                      LogicalName=AppIcon60x60@2x.png
[2024-03-18T12:26:18.008Z]                                      Optimize=false
[2024-03-18T12:26:18.008Z]                                      OriginalItemSpec=obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon60x60@2x.png
[2024-03-18T12:26:18.008Z]                                      OutputPath=bin/iPhone/Release/net8.0-ios17.0/ios-arm64/App.app/AppIcon60x60@2x.png
[2024-03-18T12:26:18.008Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-18T12:26:18.008Z]                                      LogicalName=AppIcon76x76@2x~ipad.png
[2024-03-18T12:26:18.008Z]                                      Optimize=false
[2024-03-18T12:26:18.008Z]                                      OriginalItemSpec=obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/AppIcon76x76@2x~ipad.png
[2024-03-18T12:26:18.008Z]                                      OutputPath=bin/iPhone/Release/net8.0-ios17.0/ios-arm64/App.app/AppIcon76x76@2x~ipad.png
[2024-03-18T12:26:18.008Z]                              obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
[2024-03-18T12:26:18.008Z]                                      LogicalName=Assets.car
[2024-03-18T12:26:18.008Z]                                      Optimize=false
[2024-03-18T12:26:18.008Z]                                      OriginalItemSpec=obj/iPhone/Release/net8.0-ios17.0/ios-arm64/actool/bundle/Assets.car
[2024-03-18T12:26:18.008Z]                                      OutputPath=bin/iPhone/Release/net8.0-ios17.0/ios-arm64/App.app/Assets.car
...

Related to:

@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Mar 20, 2024
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Mar 22, 2024
…h for the LogicalName property. Fixes xamarin#20330.

This fixes an issue where we'd compute a LogicalName property that was outside
of the app bundle, resulting in broken resources in the app bundle (in
particular the app icon would be missing).

So instead of something like this:

    LogicalName: ../../../../../../../../../tmp/testapp/obj/Debug/net8.0-ios/iossimulator-arm64/actool/bundle/Assets.car

we'll now get:

    LogicalName: Assets.car

and the icons will be correctly embedded in the app bundle.

Fixes xamarin#20330.
@rolfbjarne rolfbjarne added this to the Future milestone Mar 25, 2024
@rolfbjarne
Copy link
Member

I can reproduce, let me see if I can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
2 participants