-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
UWP build batchmode execution takes too long for Unity #8901
Comments
Is this reproduceable in unity 2020.1+? The Unity Issue Tracker says it's been fixed. |
I still face the same issue when building for ARM64 with GitHub Actions; Unity 2020.3.30f1: Command:
Result:
While I wonder, if not the broken ARM64 support of the current MSBuild may be the cause (.NET 3.1.23). It's also strange, that this only happens on a 2022 data-center server, but not locally on Windows 10 ... Without |
Good morning. Just to clear up some possible misunderstandings:
What we ultimately did is rewrite the method into synchronous operations: https://gist.github.com/DarkMio/674c8d43029f940c606123706228658e Since this still hangs the Unity runtime when trying to compile from within Unity, the command line exits with the msbuild commands: Now execute following commands with msbuild:
& "{{msbuild}}" "C:\agent\_work\35\b\RoomDeux.sln" /t:restore
& "{{msbuild}}" "C:\agent\_work\35\b\RoomDeux.sln" /t:Build /p:Configuration=master /p:Platform=arm64 We additionally have a tiny powershell template to find and replace msbuild - primarily because we still can't execute commandline operations in Unity and I just generally avoided to guesstimate in Unity which might be the correct compiler: # find a suitable MSBuild
$msbuild = $(& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe)
# replace the filler-text with msbuild
(Get-Content -path "${{ parameters.buildOutputPath }}\build.ps1_template" -Raw) -replace ('{{msbuild}}',"$msbuild") | Set-Content -Path "${{ parameters.buildOutputPath }}\build.ps1"
# execute that script
& "${{ parameters.buildOutputPath }}\build.ps1" |
Thanks for the prompt reply; I'll try to adopt that approach. What I'm trying to tell is, that one probably cannot cut down on time for the one build step - but lots of time for the other. |
I don't see the problem here and it's derailing the issue. If you're offended by the licensing model or have a problem understanding / orchestrating Github Actions and or cache retaining inside pipelines, then I kindly ask to approach the vendors of the products. This issue continues focusing on Additionally this has been (apparently?) addressed by Unity: https://issuetracker.unity3d.com/issues/batch-mode-async-method-invoked-from-executemethod-unexpectedly-terminated-by-quit-timeout To the maintainers: It should either be reworked (preferably, reasonably) or the (undocumented) |
I don't have any issues except the one at hand (generally that neither way properly works); hoped for That these are 2-3 companies' products, which have to work together in unison, in order to build, doesn't necessarily make it any easier to build. This current way of licensing makes sense on-premises - but not necessarily when licensing builds on partner's cloud platforms (which may be considered a "trusted environment", which may permit for other models). Being able to simplify this one step would be a huge gain (3.5 minutes of roughly an hour, which are 5.8% of the total time). On GitHub I'm calling
One can similarly start
Not using method |
We appreciate your feedback and thank you for reporting this issue. Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important. Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2. Please note that MRTK3 was released in August 2023. It features an all new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visithttps://www.mixedrealitytoolkit.org. Thank you for your continued support of the Mixed Reality Toolkit! |
Describe the bug
We're currently facing issues on our slower build machines causing builds to fail. This bug is introduced with Unity 2019.2, 2019.3 and 2019.4. Unity exits with:
We're running the editor with the following chain:
The Unity issue tracker has already a ticket for this behaviour: https://issuetracker.unity3d.com/issues/batch-mode-async-method-invoked-from-executemethod-unexpectedly-terminated-by-quit-timeout
Going through the source code, I have (successfully) tried to solve the problem by recreating the Method
StartCommandLineBuild
, making it non-async:This causes the process to hang at first, something is locking the VSWhere and MSBuild commands at some point, which I then patched again like that:
https://github.com/microsoft/MixedRealityToolkit-Unity/blob/v2.5.1/Assets/MRTK/Core/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs#L126
as well as https://github.com/microsoft/MixedRealityToolkit-Unity/blob/v2.5.1/Assets/MRTK/Core/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs#L194L206
I'm not certain why processes start to hang like that, but I'm guessing that something around the task scheduler deadlocks. Pulling these task into a new thread wasn't an option either, since the code is highly dependent on
UnityEditor
and causes lots of getter errors, because these APIs can only be called from the main-thread.This is currently a tricky situation for us - we can't patch the assembly on the fly and don't want to copy paste it, if necessary. We need to remove the async method as long as we're not upgrading to a Unity version past 2020.1.
The
-buildAppX
code changes the solution file already. It might be useful to split up the execution of msbuild and patching the.sln
in two processes.To reproduce
Steps to reproduce the behavior:
Expected behavior
Microsoft.MixedReality.Toolkit.Build.Editor.UnityPlayerBuildTools.StartCommandLineBuild should not be async.
Your setup (please complete the following information)
Target platform
The text was updated successfully, but these errors were encountered: