6

I've upgrade to the most recent Unity build (Unity 2019.3.0a7) and I'm getting a ton of errors, all the same, across different files.

My friends who I'm collaborating with are also running the same version, but don't have the errors.

There are two of them, each referencing different packages, but both referencing multiple errors inside each of the packages.

The errors are along the lines of:

(R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.

error CS1504: Source file 'D:\[...]\[UnityProject]\Library\PackageCache\com.unity.test-framework@1.0.16\UnityEngine.TestRunner\NUnitExtensions\Commands\BeforeAfterTestCommandState.cs' could not be opened -- The type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception.

And

Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.

error CS1504: Source file 'C:\Program Files\Unity\Hub\Editor\2019.3.0a7\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\UIBehaviour.cs' could not be opened -- The type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception.

Theres about 15-20 of these errors reported in the respective error logs in the console, but all say the same thing (same error code) regarding threw an exception.

I've never seen this error before, and I can't find any assistance online with it. All my packages are fully up to date. I'm at a loss.

I'd really appreciate any suggestions on how to fix this.

NeoKuro
  • 457
  • 1
  • 5
  • 21
  • 1
    Why are you guys using the alpha (aka if it didnt eat your children you should be celebrating) version. You dont normally see visual c# errors like that. as the unity compilation is done inside the unity ide. So, Id say delete the package and redownload it – BugFinder Jul 06 '19 at 11:30
  • 1
    As BugFinder already said .. don't use the **alpha** or **beta** versions except for trying out new features. They are not stable for production! Stick to the latest **stable** release version wich currently is `2019.1.8f1` (make Backups before switching versions) Since the first error referes to the `Library` folder you might want to completely reset the project folder. In [this answer](https://stackoverflow.com/a/56267992/7111561) I explained how. – derHugo Jul 06 '19 at 14:00
  • I have no idea....they insisted we use Alpha for some reason (I was hesitant, but didn't care as long as it worked - which clearly it doesn't. Time to try convince them to downgrade in the name of sanity, otherwise I guess I won't be collaborating :L :) – NeoKuro Jul 06 '19 at 16:10

2 Answers2

16

Uninstalling Anaconda and Python can result in such issues because of remaining artifacts in the Windows registry.

In my case, removing the following key in Registry Editor worked :

Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

It was targeting a file removed in the Anaconda uninstall process.

Florian Lavorel
  • 744
  • 2
  • 8
  • 14
  • Seeing this, I decided to not uninstall my Anaconda and just remove the key in Regedit, and it started to work. Looks like it's the only source of this type of issue. I'm using Unity version 2020.3.5f1. – jcameron47 Apr 28 '21 at 14:04
6
  • Close Unity
  • Remove the Library folder
  • Reopen the project in Unity and wait for Unity to reimport the project

It should work. If it doesn't then probably your Unity version has some bugs.

AminSojoudi
  • 1,904
  • 2
  • 18
  • 42
  • Sadly nothing is working. Thanks though. I've just resolved myself to downgrade (upgrade?) to the latest stable version of Unity – NeoKuro Jul 06 '19 at 16:10
  • This did not help, and weirdly the version 2019.3.0f3 worked fine a few days ago but I'm stuck with this microsoft error that won't let me compile. Erg. I tried updateing Visual Studio Community just in case the C# compiler was broken, – Gregory Fenn Jan 04 '20 at 13:50
  • 1
    ^I might have solved my issue, maybe it will help others: I can't be sure but I might have fixed it like this: see this link and the solution to what I thought was an unrelated problem https://superuser.com/questions/727316/error-in-command-line-the-system-cannot-find-the-path-specified For me, deleting the registry value for "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun" fixed it. – Gregory Fenn Jan 08 '20 at 19:11