Search Unity

Bug Build fail due to compiler errors (UWP)

Discussion in 'Editor & General Support' started by Regretful123, Jan 21, 2022.

  1. Regretful123

    Regretful123

    Joined:
    Nov 5, 2014
    Posts:
    18
    Hello everyone,

    I am trying to make a UWP build after the fact that this project can build out to Android without any problems. After switching platform from Android to UWP, all builds fail with this error log. The log does not explain why it failed, instead it just tells me it failed to build due to compiler errors.

    I checked the Editor logs, and found nothing useful there to explain why it failed.

    Can someone help guide me where or why this build is failing on UWP? I switched the platform to Windows' executable, and it works just fine. I don't know where else I could look into to understand why this fails to build. Building for Android and Windows executable works, only the UWP does not work. I need to create a UWP build for this project (Hard requirement).

    Unfortunately, I have no way of simplifying this project down for a bug report, but I can say that I have previously successfully build UWP project before (In a different project that is only for UWP). I am still unclear as to why this would fail on me.

    I went as far as to create a empty scene, make that the only scene to build, and still continue to receive the same message as shown in the image below.

    I am using Unity 2019.4.31f1 LTS.

    Code (CSharp):
    1. Start importing Assets/MaterialUI/Materials/Signed Distance Field UI.mat using Guid(5106ea80d20e1f34c9479b2163d7d1f0) Importer(-1,00000000000000000000000000000000)
    2. Done importing asset: 'Assets/MaterialUI/Materials/Signed Distance Field UI.mat' (target hash: '98178bd3858abc7e2118c2f0a36060db') in 0.037296 seconds
    3.  
    4. Refreshing native plugins compatible for Editor in 2.79 ms, found 4 plugins.
    5. Preloading 1 native plugins for Editor in 0.20 ms.
    6. RefreshInfo: StopAssetImportingV2(NoUpdateAssetOptions)
    7. RefreshProfiler: Total: 193.120ms
    8.     InvokeBeforeRefreshCallbacks: 0.001ms
    9.     ApplyChangesToAssetFolders: 0.078ms
    10.     WriteModifiedImportersToTextMetaFiles: 0.000ms
    11.     CleanLegacyArtifacts: 0.000ms
    12.     Scan: 13.925ms
    13.     OnSourceAssetsModified: 0.920ms
    14.     UnregisterDeletedAssets: 0.000ms
    15.     InitializeImportedAssetsSnapshot: 10.618ms
    16.     GetAllGuidsForCategorization: 0.470ms
    17.     CategorizeAssets: 2.430ms
    18.     ImportAndPostprocessOutOfDateAssets: 147.108ms (8.605ms without children)
    19.         ImportManagerImport: 60.044ms (8.499ms without children)
    20.             ImportInProcess: 51.476ms
    21.             ImportOutOfProcess: 0.000ms
    22.             UpdateCategorizedAssets: 0.068ms
    23.             RemoteAssetCacheGetArtifact: 0.000ms (0.000ms without children)
    24.                 RemoteAssetCacheResolve: 0.000ms
    25.                 RemoteAssetCacheDownloadFile: 0.000ms
    26.         CompileScripts: 0.000ms
    27.         PostProcessAllAssets: 55.591ms
    28.         ReloadImportedAssets: 0.001ms
    29.         VerifyAssetsAreUpToDateAndCorrect: 0.000ms
    30.         EnsureUptoDateAssetsAreRegisteredWithGuidPM: 0.608ms
    31.         InitializingProgressBar: 0.001ms
    32.         PostProcessAllAssetNotificationsAddChangedAssets: 0.319ms
    33.         OnDemandSchedulerStart: 0.381ms
    34.         RestoreLoadedAssetsState: 5.934ms
    35.     InvokeProjectHasChanged: 0.000ms
    36.     UpdateImportedAssetsSnapshot: 15.625ms
    37.     ReloadSourceAssets: 2.654ms
    38.     UnloadImportedAssets: 0.202ms
    39.     Hotreload: 9.093ms
    40.     FixTempGuids: 0.006ms
    41.     VerifyGuidPMRegistrations: 0.000ms
    42.     GatherAllCurrentPrimaryArtifactRevisions: 0.476ms
    43.     UnloadStreamsBegin: 0.029ms
    44.     LoadedImportedAssetsSnapshotReleaseGCHandles: 1.379ms
    45.     GetLoadedSourceAssetsSnapshot: 13.607ms
    46.     PersistCurrentRevisions: 0.000ms
    47.     UnloadStreamsEnd: 0.231ms
    48.     GenerateScriptTypeHashes: 0.000ms
    49.     Untracked: -10.106ms
    50. [ScriptCompilation] Recompiling all scripts because: Recompiling scripts for player build.
    51. BuildPlayer: start building target 21
    52. [ScriptCompilation] Recompiling all scripts because: Recompiling scripts for editor because player build failed.
    53. DisplayProgressNotification: Build Failed
    54. Error building Player because scripts had compiler errors
    55. Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
    56. System memory in use before: 116.9 MB.
    57. System memory in use after: 117.9 MB.
    58.  
    59. Unloading 169 unused Assets to reduce memory usage. Loaded Objects now: 17610.
    60. Total: 42.762900 ms (FindLiveObjects: 2.289200 ms CreateObjectMapping: 0.538400 ms MarkObjects: 39.664500 ms  DeleteObjects: 0.270100 ms)
    61.  
    62. LightmapEditorSettings: switching bake backend from 1 to 0.
    63. Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
    64. Loaded scene 'Temp/__Backupscenes/0.backup'
    65.     Deserialize:            144.127 ms
    66.     Integration:            153.964 ms
    67.     Integration of assets:  0.013 ms
    68.     Thread Wait Time:       22.965 ms
    69.     Total Operation Time:   321.068 ms
    70. System memory in use before: 114.6 MB.
    71. System memory in use after: 115.7 MB.
    72.  
    73. Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 17603.
    74. Total: 44.156100 ms (FindLiveObjects: 2.344000 ms CreateObjectMapping: 0.431400 ms MarkObjects: 41.350200 ms  DeleteObjects: 0.029900 ms)
    75.  
    76. Build completed with a result of 'Failed' in 6 seconds (5585 ms)
    77. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    78. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    79. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    80. UnityEngine.Debug:LogError (object)
    81. UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
    82. UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
    83. UnityEditor.BuildPlayerWindow:GUIBuildButtons (UnityEditor.Modules.IBuildWindowExtension,bool,bool,bool,UnityEditor.Build.BuildPlatform)
    84. UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings ()
    85. UnityEditor.BuildPlayerWindow:OnGUI ()
    86. System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)...
    87. UnityEngine.GUIUtility:ProcessEvent (int,intptr)
    88. (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)
    Here's my build settings


    Here's the error message I received in
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Regretful123 Does a new/empty project build to UWP for you, for comparison?
     
  3. Regretful123

    Regretful123

    Joined:
    Nov 5, 2014
    Posts:
    18
    Created a new empty game project using the version above with the exact build settings as shown in the picture above, I can export the empty project out.
    Still, it bugs me that I cannot find the script that's breaking the build.

    Edit: What it sounds like here is that somewhere in the recompiling code, a preprocessor condition was not handled properly... How can I make this exposed/visible?
    This is what brought up the preprocessor for a bit -

    Code (CSharp):
    1. ...
    2. [ScriptCompilation] Recompiling all scripts because: Recompiling scripts for player build.
    3. BuildPlayer: start building target 21
    4. [ScriptCompilation] Recompiling all scripts because: Recompiling scripts for editor because player build failed.
    5. DisplayProgressNotification: Build Failed
    6. ...
     
    Last edited: Jan 21, 2022
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  5. Regretful123

    Regretful123

    Joined:
    Nov 5, 2014
    Posts:
    18
    I fear for the worst. Going to clone this project and then just start slowly removing plugin/script/scene until the compiler works.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    This is very clearly a bug in Unity, it shouldn't ever give you an error like that. Would you be able to submit your project as is in a bug report?

    I suspect deleting the library folder will make it work for you again.
     
    Regretful123 likes this.
  7. Regretful123

    Regretful123

    Joined:
    Nov 5, 2014
    Posts:
    18
    I used JeffD's divide and conquer technique. As it turns out, the root cause to prevent the build was coming from one of the plugins "AppCenter". This is no longer a bug with Unity, instead this is a bug with Microsoft's plugin. We were unable to update the plugin, so we ended up having to remove the plugin to get the project exported. Eventually, I'd like to come back to this and understand why the plugin would cause the compile to fail.
     
  8. Regretful123

    Regretful123

    Joined:
    Nov 5, 2014
    Posts:
    18
    I've minimized the project down to the barebone to expose the problem.

    Please see the case number 1398676 from FogBugz. Let me know if you have any more question.

    As to answer to this thread problem, the culprit was that I had two Newtonsoft.Json plugin. One was natively in the Assets/Plugin folder where I need to access. I was unaware that AppCenter also have their own Newtonsoft.json plugin in the AppCenter plugin's folder. The combination of those two plugin exist in the same project was the result of the build failing. However, this doesn't explain why Unity Editor suppresses this message that I needed to see.

    I would have expected to see this message.

    Thanks @JeffDUnity3D and @Tautvydas-Zilys! Hope to see this patch on the next version!
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks for the bug report!
     
    Regretful123 likes this.
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446