Search Unity

Bug [2021.1.0f1] Could not find a part of the path 'E:\TestProject\Unity[^\]+(\.ref)?\.dll$'

Discussion in 'Editor & General Support' started by HP, Mar 23, 2021.

  1. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    I installed Unity 2021.1.0f1 today and opened my project. Then a couple of projects were updated via the Package Manager and suddenly this error appeared:

    Code (CSharp):
    1. Script updater for Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp-Editor.dll failed with exitcode -532462766 and stdout: Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    2. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TestProject\Unity[^\]+(\.ref)?\.dll$'.
    3.    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    4.    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    5.    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    6.    at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
    7.    at System.IO.StreamReader..ctor(String path)
    8.    at ScriptUpdater.Program.<>c__DisplayClass8_0.<Main>b__0()
    9.    at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
    10.    at ScriptUpdater.Program.Main(String[] args)
    11.    --- End of inner exception stack trace ---
    12.    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    13.    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    14.    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    15.    at Program.Main(String[] args)
    16.  
    The last updated project was "MicroSplat - Terrain Collection".
    Probably the error has nothing to do with microsplat.
    I don't quite understand the error message. Why is it looking for a "Unity * .DLL" in the root directory of my project?

    Same error:
    Script updater for Library\Bee\artifacts\1900b0aEDbg.dag\Assembly-CSharp-Editor.dll failed
     
    Last edited: Mar 24, 2021
    Lipoly likes this.
  2. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    From my editor log file:
    Code (CSharp):
    1. *** Tundra build success (8.11 seconds), 14 items updated, 1674 evaluated
    2. Starting: C:\Program Files\Unity3D\2021.1.0f1\Editor\Data\Tools\netcorerun\netcorerun.exe "C:/Program Files/Unity3D/2021.1.0f1/Editor/Data/Tools/ScriptUpdater/ScriptUpdater.exe" cs C:/Program Files/Unity3D/2021.1.0f1/Editor/Data "Temp/ScriptUpdater/1655989618" "Unity[^\\]+(\.ref)?\.dll$" "Library/Bee/artifacts/1900b0aE.dag/Assembly-CSharp-Editor.rsp"
    3. WorkingDir: E:/TestProject
    4. ExitCode: -532462766 Duration: 1s214ms
    5. Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    6. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TestProject\Unity[^\]+(\.ref)?\.dll$'.
    7.    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    8.    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    9.    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    10.    at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
    11.    at System.IO.StreamReader..ctor(String path)
    12.    at ScriptUpdater.Program.<>c__DisplayClass8_0.<Main>b__0()
    13.    at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
    14.    at ScriptUpdater.Program.Main(String[] args)
    15.    --- End of inner exception stack trace ---
    16.    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    17.    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    18.    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    19.    at Program.Main(String[] args)
    20. Script updater for Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp-Editor.dll failed with exitcode -532462766 and stdout: Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    21. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TestProject\Unity[^\]+(\.ref)?\.dll$'.
    22.    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    23.    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    24.    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    25.    at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
    26.    at System.IO.StreamReader..ctor(String path)
    27.    at ScriptUpdater.Program.<>c__DisplayClass8_0.<Main>b__0()
    28.    at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
    29.    at ScriptUpdater.Program.Main(String[] args)
    30.    --- End of inner exception stack trace ---
    31.    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    32.    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    33.    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    34.    at Program.Main(String[] args)
    35.  
     
  3. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    Same error, seems to be post script compilation
     
  4. Qwolf

    Qwolf

    Joined:
    Feb 1, 2014
    Posts:
    28
    I'm getting a similar issue:

    Code (CSharp):
    1. Script updater for Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp.dll failed with exitcode -532462766 and stdout: Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    2. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\qwolf\Documents\ErrorTestProject\Unity[^\]+(\.ref)?\.dll$'.
    3.    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    4.    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    5.    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    6.    at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
    7.    at System.IO.StreamReader..ctor(String path)
    8.    at ScriptUpdater.Program.<>c__DisplayClass8_0.<Main>b__0()
    9.    at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
    10.    at ScriptUpdater.Program.Main(String[] args)
    11.    --- End of inner exception stack trace ---
    12.    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    13.    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    14.    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    15.    at Program.Main(String[] args)
    I've done some work trying to isolate what package causes this, and in my case, it appears to be the SteamAudio unitypackage.

    If anyone wants to mess around with this, make a new 2021.1.0f1 URP project, and import SteamAudio.
    Add a script to edit to force a recompile, and the error should appear.
    Restarting Unity makes it go away, and all scripts are compiled correctly, so I agree with CianNoonan that it must be a post compilation problem.

    Working on isolating what script in the package is causing it...
     
  5. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    I managed to get this issue without SteamAudio, must be some common issue between my project and SteamAudio
     
  6. Qwolf

    Qwolf

    Joined:
    Feb 1, 2014
    Posts:
    28
    I believe I've figured out what the issue is.

    The error occurs post-compilation and to stems from ScriptUpdater, which I believe to be Unity's API Updater (which just got a major revision going from 2020.x to 2021.x).

    By importing the problematic library (in my case Steam Audio), into a Unity 2020.x project, the API Updater opens the prompt as expected.
    In a 2021.x project, it throws the following error, and nothing more:

    Code (CSharp):
    1. Script updater for Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp.dll failed with exitcode -532462766 and stdout: Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    2. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\qwolf\Documents\ErrorDemo\Unity[^\]+(\.ref)?\.dll$'.
    3.    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    4.    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    5.    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    6.    at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
    7.    at System.IO.StreamReader..ctor(String path)
    8.    at ScriptUpdater.Program.<>c__DisplayClass8_0.<Main>b__0()
    9.    at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
    10.    at ScriptUpdater.Program.Main(String[] args)
    11.    --- End of inner exception stack trace ---
    12.    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    13.    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    14.    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    15.    at Program.Main(String[] args)
    Since the 2020 API updater lists the used obsolete APIs, I've solved the problem for myself, but this error will still be thrown if obsolete APIs are used.

    Easiest Recreation Steps:
    Create a new Unity 2021.1.0f1 project
    Add the following line to a script:

    var w = Terrain.activeTerrain.terrainData.heightmapWidth;


    This will throw the error mentioned above, but surprisingly, also throws a warning for the use of the obsolete API, which was not the case with the Steam Audio library.

    Hope this helps you fix the issue in your project!
    Already opened a bug report ticket with Unity, so hopefully this gets solved soon.
     
    Lipoly likes this.