Unity 5.5.0f3 APIUpdater encountered some issues and was not able to finish - mono stack trace

Hi,
I have a project running on 5.5.0f3 that can no longer run the APIUpdater. I have tried on 5.4.3 as well so I don’t think it’s Unity version dependent. I get the following stack trace in the console without any indication of which source file of ours failed. Is this a Unity bug or is there some way that I can track down which file / asset causes this?

filename unknown>:0
at Mono.CSharp.StructuralVisitor.VisitTypeDefinition (Mono.CSharp.TypeDefinition tc) <0x2babfe8 + 0x0005b> in :0
at Mono.CSharp.StructuralVisitor.Visit (Mono.CSharp.Class c) <0x2babfc0 + 0x00017> in :0
at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.Class c) <0x2baa148 + 0x0055b> in :0
at Mono.CSharp.Class.Accept (Mono.CSharp.StructuralVisitor visitor) <0x2baa128 + 0x0001a> in :0
at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.ModuleContainer mc) <0x2ba7610 + 0x004fa> in :0
at Mono.CSharp.ModuleContainer.Accept (Mono.CSharp.StructuralVisitor visitor) <0x2ba64e8 + 0x0001a> in :0
at ICSharpCode.NRefactory.CSharp.CSharpParser.Parse (Mono.CSharp.CompilerCompilationUnit top, System.String fileName) <0x2ba4af8 + 0x000a8> in :0
at ICSharpCode.NRefactory.CSharp.CSharpParser.Parse (ITextSource program, System.String fileName, Int32 initialLine, Int32 initialColumn) <0x2b76b08 + 0x0031b> in :0
at ICSharpCode.NRefactory.CSharp.CSharpParser.Parse (ITextSource program, System.String fileName) <0x2b76a98 + 0x00043> in :0
at CSharpUpdater.Core.CSharpProjectHelper.SourceFilesDataFor (IEnumerable1 sourceFiles, IEnumerable1 defines, IAPIUpdaterListener logger) <0x2b74be0 + 0x0016b> in :0
at CSharpUpdater.CSharpUpdater.RunUpdater (APIUpdater.Framework.Core.SourceFile[ ] inputs, IEnumerable1 defines, IEnumerable1 references) <0x2b747c8 + 0x0008f> in :0
at APIUpdater.Framework.Core.APIUpdaterBase.Update (APIUpdater.Framework.Core.SourceFile[ ] inputs, IEnumerable1 defines, IEnumerable1 references) <0x2b74600 + 0x0006b> in :0
at ScriptUpdater.Program.UpdateLanguage (IScriptUpdater updater, APIUpdater.Framework.Configuration.CompilerResponseFile responseFile, System.String unityDataPath, System.String outputPath) <0x2b62e30 + 0x0020d> in :0
at ScriptUpdater.Program.Main (System.String[ ] args) <0x2ad0f28 + 0x00223> in :0

The API updater runs and fails for some reason (it would be helpful if it would print which class it was processing at the moment of crash…)

You can try to debug the script updater process to find this out yourself, or you can turn off script updating (i believe there’s such an option, but i may be wrong). This is just a temporary workaround… in case you don’t really need to update anything automatically.

Yeah, all it give is “”, not too helpful… I’m pretty sure that I’ve seen in the past where it’s actually identified the files and their problems so this looks like a bug to me. I can always ignore it but I’d really like to know what exactly it thinks needs updating.

As i said - you can probably debug this.

Since this is not running in the Unity.exe process (i think), but instead spawns another process, you’d have to debug that child process and watch it as it throws this exception.

I believe there are tools to do that, for example: Introducing the Child Process Debugging Power Tool - Azure DevOps Blog

Let me know if you need any help with this :slight_smile: sounds like a fun debugging exercise…

I will look into attaching the debugger to that process and maybe that will help if I can have it stop on exception. Optimally Unity would get this fixed so that these APIUpdater failures would actually more reliably point to the source of the errors. It seems like sometimes it is able to identify the source failure and other times it just silently fails with a random invalid cast exception as shown above.