Search Issue Tracker

Won't Fix

Votes

1

Found in

2022.3.16f1

2023.2.4f1

2023.3.0b1

Issue ID

UUM-59574

Regression

Yes

"Unexpected duplicate tasks" error in Xcode when the project is rebuilt

--

-

Reproduction steps:
1. Open the attached project “ReproProj”
2. Go to File > Build Settings and choose iOS build target
3. Make sure that the build uses Xcode 15.x and press Build And Run
4. Wait for the build to finish
5. In the opened Xcode project, if needed, change Xcode scheme to “UnityFramework” and press the Build button
6. Go back to Editor and press CMD+B
7. Press the Build button in Xcode
8. Observe Xcode logs

Expected result: Xcode Build succeeds
Actual result: Xcode Build fails with “Unexpected duplicate tasks” error

Reproducible with: 2022.2.21f1, 2022.3.16f1, 2023.2.4f1, 2023.3.0b1
Not reproducible with: 2021.3.34f1, 2022.1.24f1, 2022.2.0a13
Couldn't test 2022.2.0a14 - 2022.2.20f1 (“BuildFailedException: Incremental Player build failed!”)

Reproducible on: macOS 14.2 (M1 Max), macOS 14.0 (Intel)
Not reproducible on: No other environment tested

Note: As a workaround, from the second time on, build the project from the Build Settings window using Build And Run and selecting the "Replace" option when prompted by macOS

  1. Resolution Note:

    There is an issue with postprocess script, where shell script build phase is edited manually:

    if (section == "PBXShellScriptBuildPhase" && line.Trim().StartsWith("shellScript"))
    {
    pbxproj.Flush();
    pbxproj.BaseStream.Seek(-2L - Environment.NewLine.Length, SeekOrigin.Current);
    pbxproj.WriteLine("\\necho \\\"Hello\\\"\";");
    }

    What is happening, is that we add shell script in GameAssembly to run il2cpp build.
    Now, we really need il2cpp build properly done, so we always add this run script phase with proper commandline etc.
    This works in both replace and append, since internally (in PBXProject) when adding shellscript phase, we are checking first if such phase exists already (by comparing name/commandline/some other things), see https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.AddShellScriptBuildPhase.html
    Since pbxproject *text* itself is edited, when we load it to append, the buildphase that GameAssembly needs is different from what is in the project, so it is added anew. And mind you we cannot just delete previous one because this is, kinda, no longer "unity added it and controls it"

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.