Unity 2019.4.26 LTS : StackOverflowException crashing the editor when building

Hello,

Unity is throwing a stack overflow when I’m trying to build for Windows, and it stay locked on “Build Player” loading. So I must kill it with the task manager and go check the log in the Editor.log file.
We have same problem on every machine, so it seem to be on the project side, and I can build by going back in the git history.

The error is similar to this guy in 2018, but none of his solutions seem to work :

I tried:

  • renaming Resources folder
  • to reimport assets using Assets>Reimport All
  • removing plugins we imported since the last functional build (Houdini engine integration)
  • regenerating .meta files

Nothing worked, i’m totaly lost, it’s my first thread in 5 years using the engine.

Thanks for your help,
Louis

Here the error log :

[ScriptCompilation] Recompiling all scripts because: Recompiling scripts for player build.
BuildPlayer: start building target 19
- Starting script compilation
- Starting compile Library/PlayerScriptAssemblies/UnityEngine.UI.dll
- Starting compile Library/PlayerScriptAssemblies/UnityEngine.TestRunner.dll
- Finished compile Library/PlayerScriptAssemblies/UnityEngine.UI.dll in 1.537593 seconds
- Finished compile Library/PlayerScriptAssemblies/UnityEngine.TestRunner.dll in 1.52594 seconds
- Starting compile Library/PlayerScriptAssemblies/Unity.InputSystem.dll
- Starting compile Library/PlayerScriptAssemblies/Unity.TextMeshPro.dll
- Starting compile Library/PlayerScriptAssemblies/Unity.Timeline.dll
- Starting compile Library/PlayerScriptAssemblies/NaughtyAttributes.Core.dll
- Starting compile Library/PlayerScriptAssemblies/Unity.ProBuilder.Poly2Tri.dll
- Starting compile Library/PlayerScriptAssemblies/Unity.ProBuilder.KdTree.dll
- Starting compile Library/PlayerScriptAssemblies/Unity.ProBuilder.Stl.dll
- Starting compile Library/PlayerScriptAssemblies/Unity.ProGrids.dll
- Finished compile Library/PlayerScriptAssemblies/NaughtyAttributes.Core.dll in 1.335848 seconds
- Starting compile Library/PlayerScriptAssemblies/NaughtyAttributes.Test.dll
- Finished compile Library/PlayerScriptAssemblies/Unity.ProBuilder.KdTree.dll in 1.386941 seconds
- Finished compile Library/PlayerScriptAssemblies/Unity.ProBuilder.Stl.dll in 1.369804 seconds
- Starting compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll
- Starting compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.Core.ShaderLibrary.dll
- Finished compile Library/PlayerScriptAssemblies/Unity.ProBuilder.Poly2Tri.dll in 1.554542 seconds
- Starting compile Library/PlayerScriptAssemblies/Unity.ProBuilder.dll
- Finished compile Library/PlayerScriptAssemblies/Unity.Timeline.dll in 1.640262 seconds
- Starting compile Library/PlayerScriptAssemblies/Unity.VisualEffectGraph.Runtime.dll
- Finished compile Library/PlayerScriptAssemblies/Unity.ProGrids.dll in 1.576294 seconds
- Finished compile Library/PlayerScriptAssemblies/Unity.TextMeshPro.dll in 1.799077 seconds
- Finished compile Library/PlayerScriptAssemblies/Unity.InputSystem.dll in 2.096617 seconds
- Starting compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.Core.Runtime.dll
- Finished compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.Core.ShaderLibrary.dll in 0.658855 seconds
- Finished compile Library/PlayerScriptAssemblies/NaughtyAttributes.Test.dll in 0.747315 seconds
- Finished compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll in 0.784091 seconds
- Finished compile Library/PlayerScriptAssemblies/Unity.VisualEffectGraph.Runtime.dll in 0.835447 seconds
- Finished compile Library/PlayerScriptAssemblies/Unity.ProBuilder.dll in 1.00976 seconds
- Finished compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.Core.Runtime.dll in 0.783441 seconds
- Starting compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.HighDefinition.Config.Runtime.dll
- Finished compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.HighDefinition.Config.Runtime.dll in 0.35492 seconds
- Starting compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.HighDefinition.Runtime.dll
- Finished compile Library/PlayerScriptAssemblies/Unity.RenderPipelines.HighDefinition.Runtime.dll in 1.951424 seconds
- Starting compile Library/PlayerScriptAssemblies/Assembly-CSharp-firstpass.dll
- Finished compile Library/PlayerScriptAssemblies/Assembly-CSharp-firstpass.dll in 0.916848 seconds
- Starting compile Library/PlayerScriptAssemblies/Assembly-CSharp.dll
- Finished compile Library/PlayerScriptAssemblies/Assembly-CSharp.dll in 0.416198 seconds
- Finished script compilation in 8.232186 seconds
Assets\2_Features\Phyllotaxis\Phyllotaxis.cs(10,39): warning CS0414: The field 'Phyllotaxis.nRange' is assigned but its value is never used
Assets\2_Features\Phyllotaxis\Phyllotaxis.cs(9,34): warning CS0414: The field 'Phyllotaxis.radiusOffs' is assigned but its value is never used
Assets\2_Features\Phyllotaxis\Phyllotaxis.cs(8,34): warning CS0414: The field 'Phyllotaxis.angleOffs' is assigned but its value is never used
Refresh completed in 0.306995 seconds.
RefreshInfo: RefreshV2()
RefreshProfiler: Total: 305.711ms
    InvokeBeforeRefreshCallbacks: 0.001ms
    ApplyChangesToAssetFolders: 0.065ms
    WriteModifiedImportersToTextMetaFiles: 0.000ms
    CleanLegacyArtifacts: 0.000ms
    Scan: 196.116ms
    OnSourceAssetsModified: 0.000ms
    UnregisterDeletedAssets: 0.000ms
    InitializeImportedAssetsSnapshot: 8.169ms
    GetAllGuidsForCategorization: 0.481ms
    CategorizeAssets: 80.354ms
    ImportAndPostprocessOutOfDateAssets: 10.006ms (2.984ms without children)
        ImportManagerImport: 0.000ms (0.000ms without children)
            ImportInProcess: 0.000ms
            ImportOutOfProcess: 0.000ms
            UpdateCategorizedAssets: 0.000ms
            RemoteAssetCacheGetArtifact: 0.000ms (0.000ms without children)
                RemoteAssetCacheResolve: 0.000ms
                RemoteAssetCacheDownloadFile: 0.000ms
        CompileScripts: 0.000ms
        PostProcessAllAssets: 0.001ms
        ReloadImportedAssets: 0.000ms
        VerifyAssetsAreUpToDateAndCorrect: 0.000ms
        EnsureUptoDateAssetsAreRegisteredWithGuidPM: 1.402ms
        InitializingProgressBar: 0.000ms
        PostProcessAllAssetNotificationsAddChangedAssets: 0.363ms
        OnDemandSchedulerStart: 0.367ms
        RestoreLoadedAssetsState: 4.889ms
    InvokeProjectHasChanged: 0.000ms
    UpdateImportedAssetsSnapshot: 0.000ms
    ReloadSourceAssets: 2.958ms
    UnloadImportedAssets: 0.292ms
    Hotreload: 0.032ms
    FixTempGuids: 0.005ms
    VerifyGuidPMRegistrations: 0.000ms
    GatherAllCurrentPrimaryArtifactRevisions: 0.521ms
    UnloadStreamsBegin: 0.080ms
    LoadedImportedAssetsSnapshotReleaseGCHandles: 1.678ms
    GetLoadedSourceAssetsSnapshot: 7.177ms
    PersistCurrentRevisions: 0.000ms
    UnloadStreamsEnd: 0.022ms
    GenerateScriptTypeHashes: 0.000ms
    Untracked: -2.247ms
StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) UnityEditor.BuildPipeline.BuildPlayerInternalNoCheck(string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,bool)
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x001c9] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at UnityEditor.BuildPlayerWindow.GUIBuildButtons (UnityEditor.Modules.IBuildWindowExtension buildWindowExtension, System.Boolean enableBuildButton, System.Boolean enableBuildAndRunButton, System.Boolean canInstallInBuildFolder, UnityEditor.Build.BuildPlatform platform) [0x002c0] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at UnityEditor.BuildPlayerWindow.ShowBuildTargetSettings () [0x00955] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at UnityEditor.BuildPlayerWindow.OnGUI () [0x001aa] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <eae584ce26bc40229c1b1aa476bfa589>:0
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <eae584ce26bc40229c1b1aa476bfa589>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
  at UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) [0x0000f] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at UnityEditor.HostView.Invoke (System.String methodName) [0x00001] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at UnityEditor.HostView.OldOnGUI () [0x00042] in <e6522990dfdf40458abbd5eeeb595b91>:0
  at UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x001e9] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x00072] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x00015] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) [0x00009] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) [0x00023] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) [0x00059] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) [0x00009] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x001ab] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) [0x00025] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00043] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00035] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.EventDispatcher.OpenGate () [0x0003b] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.EventDispatcherGate.Dispose () [0x00001] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00105] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) [0x00046] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) [0x0001a] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) [0x000b0] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) [0x0003d] in <5569c6d49a3b43fc83c44b1af0cde4d3>:0
  at UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) [0x0000d] in <023156577e4f4156adf0f4b3a3fedf85>:0

The bug was caused by the HoudiniEngineUnity plugin. Deleting it didn’t worked so the solution was to import my assets in a new project without importing Houdini and then I imported the lastest houdini version and it worked.