Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity 2019.3.0a7: Microsoft Visual C# Compiler Errors

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\[email protected]\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.

like image 890
NeoKuro Avatar asked Jul 06 '19 11:07

NeoKuro


2 Answers

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.

like image 132
Florian Lavorel Avatar answered Oct 20 '22 17:10

Florian Lavorel


  • 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.

like image 36
AminSojoudi Avatar answered Oct 20 '22 16:10

AminSojoudi