简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM