Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

System.InvalidOperationException: Operation is not valid due to the current state of the object.

Discussion in 'Scripting' started by oobartez, Apr 19, 2019.

  1. oobartez

    oobartez

    Joined:
    Oct 12, 2016
    Posts:
    167
    We get the following error on Unity 2018.3.12f when first opening a project, after deleting the Library folder. Any ideas what could be causing this or how to track the problem? The log does not include any helpful information.

    Code (CSharp):
    1.  
    2. System.InvalidOperationException: Operation is not valid due to the current state of the object.
    3.   at Mono.Cecil.ModuleDefinition.ReadSymbols (Mono.Cecil.Cil.ISymbolReader reader) [0x0002f] in <a3989f8c34e6476eaca56644d5639ee8>:0
    4.   at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x0004a] in <a3989f8c34e6476eaca56644d5639ee8>:0
    5.   at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <a3989f8c34e6476eaca56644d5639ee8>:0
    6.   at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable`1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <a3989f8c34e6476eaca56644d5639ee8>:0
    7.   at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <a3989f8c34e6476eaca56644d5639ee8>:0
    8.   at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <a3989f8c34e6476eaca56644d5639ee8>:0
    9.   at AssemblyUpdater.Core.AssemblyUpdaterContext.ReadAssembly (System.String assemblyPath, APIUpdater.Framework.Log.IAPIUpdaterListener listener, System.IO.FileAccess mode, System.String nugetPath, System.String[] searchPaths) [0x00072] in <01149d34860e4a20bae30d023c3dc066>:0
    10.   at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, APIUpdater.Framework.Configuration.IConfigurationProvider configuration, System.String[] assemblySearchPaths, System.String nugetPath, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x0002c] in <01149d34860e4a20bae30d023c3dc066>:0
    11.   at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, System.String[] assemblySearchPaths, System.String nugetPath, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x00001] in <01149d34860e4a20bae30d023c3dc066>:0
    12.   at AssemblyUpdater.Application.Program.CheckForObsoleteAPIUsage (AssemblyUpdater.Application.CommandLineSpec config, APIUpdater.Framework.Log.ConsoleUpdateListener logger) [0x00013] in <01149d34860e4a20bae30d023c3dc066>:0
    13.   at AssemblyUpdater.Application.Program.Main (System.String[] args) [0x00057] in <01149d34860e4a20bae30d023c3dc066>:0
    14. UnityEditor.Scripting.APIUpdaterAssemblyHelper:DoesAssemblyRequireUpgrade(String)
    15.  
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,936
    That crash log smells like maybe it was during the offer to update your API usages.

    ASSUMING you are using source control, and that you have committed everything necessary to source control, try deleting various source code and/or DLL code from your project and reopening Unity.

    If the problem goes away, then use source control to selectively restore folders or files of your work, giving control back to Unity between each step and seeing which script might be causing the above error.

    This might not help, given that the API updater might not even trigger until you get a clean compile, but it might net you some intel.
     
    nofilenamed likes this.