Search Issue Tracker

By Design



Found in





Issue ID




[Roslyn] VBCSCompiler.exe remains running after Unity build has finished when building Unity Player in batch mode



How to reproduce:
1. Create a new Unity project
2. Open PowerShell window
3. Run this command: "('- path to the Editor -\Unity.exe -projectPath "- path to the project -" -batchMode -quit -buildWindows64Player $pwd/Build/MyProject.exe -NoNewWindow -Wait -PassThru).ExitCode"
4. Wait for the build to finish
5. Open the Task Manager
6. Notice that the VBCSCompiler.exe is still running

Expected: VBCSCompiler.exe is shut down after the build finishes
Actual: VBCSCompiler.exe keeps running after the build finished until it times out

Reproducible with: 2018.3.13f1, 2019.1.0f2, 2019.2.0a11

Note: Roslyn Compiler was introduced in Unity 2018.3

  1. Response avatar

    Resolution Note (fix version ):

    The C# compiler runs in server mode and may outlive the lifetime of the Unity Editor.

Comments (6)

  1. 17b1a42f6f3a2b00ff9c7bdcf65b0e1a?d=mm


    Aug 06, 2019 07:25

    As others have said, the compiler not getting stopped causes a mess on CI machines.

  2. Bcd371fa5c137e9735ccf155bc63b03c?d=mm


    Jul 25, 2019 20:37

    dotnet core team were faced with a similar issue and they introduced a command to close the build tools cleanly.

    refer to for more details.

    Since you are using Roselyn as well I would think that there should be a programmatic way to achieve the same result. Now, this behaviour is indeed by design so perhaps only activate this shutdown mechanics when running in batch mode, or perhaps though a specific command line argument.

    This may not be much of an issue when running Unity as a content creator or a programmer but it really wreak havoc on a CI system. In some cases it would cause the build to hang indefinitely at the very least it prevents the environment to be properly cleaned and propagated meaning that each job will no longer be in isolation but will have hidden dependencies on previous jobs that ran on the build node.

  3. 1c40de712219b4c3d213cdda42ad8249?d=mm


    Jul 10, 2019 07:47

    It's scary that Unity declares it as "by Design". This is a shitty design to be accurate. If I run in batch mode (for example on a CI server) I want to know when Unity is finished. Why the hell do you think this is a good design? Kill the fcking compiler when you're finished.

    The only way to get around this manually is to check every x seconds how many sub processes my script has spawned and check whether Unity.exe is one of them. If not, kill VBCSCompiler.
    Sad solution but thanks to Unity we have to do this.

  4. 28feeb032f61946eb8c62caff5d099ca?d=mm


    Jun 17, 2019 12:31

    So this is annoying, as our companies current setup has a batch file open unity in command mode with no GUI, do some asset bundle building in unity, then uploads the files afterwards. However, because the VBCSCompiler doesn't close, the batch command file thinks unity is still open, and wont execute the upload unless force killed.

    Any ideas as to how to get around that?

  5. 70926bd2c8d2127864743dd6ac7c2c53?d=mm


    May 31, 2019 18:35

    I'm having an issue on one of my machines where VBCSCompiler.exe is still running and out of control to the point of locking up the system. Unsure if it's related to this, but this is the closest thing I've been able to Google about it.

  6. 047abea50204b862397781549203004a?d=mm


    May 17, 2019 23:15

    This is also happening in 2018.4.0.

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.