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

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:

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.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TestProject\Unity[^\]+(\.ref)?\.dll

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\artifacts900b0aEDbg.dag\Assembly-CSharp-Editor.dll failed .
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.StreamReader…ctor(String path)
at ScriptUpdater.Program.<>c__DisplayClass8_0.b__0()
at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
at ScriptUpdater.Program.Main(String args)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object parameters)
at Program.Main(String args)


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\artifacts900b0aEDbg.dag\Assembly-CSharp-Editor.dll failed](https://discussions.unity.com/t/833829)
1 Like

From my editor log file:

*** Tundra build success (8.11 seconds), 14 items updated, 1674 evaluated
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"
WorkingDir: E:/TestProject
ExitCode: -532462766 Duration: 1s214ms
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TestProject\Unity[^\]+(\.ref)?\.dll

.
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.StreamReader…ctor(String path)
at ScriptUpdater.Program.<>c__DisplayClass8_0.b__0()
at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
at ScriptUpdater.Program.Main(String args)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object parameters)
at Program.Main(String args)
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.
—> System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TestProject\Unity[^]+(.ref)?.dll


.
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path)
   at ScriptUpdater.Program.<>c__DisplayClass8_0.<Main>b__0()
   at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
   at ScriptUpdater.Program.Main(String[] args)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Program.Main(String[] args)

Same error, seems to be post script compilation

I’m getting a similar issue:

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.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\qwolf\Documents\ErrorTestProject\Unity[^\]+(\.ref)?\.dll

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…
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.StreamReader…ctor(String path)
at ScriptUpdater.Program.<>c__DisplayClass8_0.b__0()
at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
at ScriptUpdater.Program.Main(String args)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object parameters)
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](https://github.com/ValveSoftware/steam-audio/releases/download/v2.0-beta.19/steamaudio_unity_2.0-beta.19.zip).
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...

I managed to get this issue without SteamAudio, must be some common issue between my project and SteamAudio

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:

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.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\qwolf\Documents\ErrorDemo\Unity[^\]+(\.ref)?\.dll

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…
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.StreamReader…ctor(String path)
at ScriptUpdater.Program.<>c__DisplayClass8_0.b__0()
at ScriptUpdater.Program.Profile[T](Func`1 toProfile, Int64& elapsedTime)
at ScriptUpdater.Program.Main(String args)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object parameters)
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.
1 Like