Unity 2019.3.0a7: Microsoft Visual C# Compiler Errors

非 Y 不嫁゛ 提交于 2021-01-27 05:31:38

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/56913616/unity-2019-3-0a7-microsoft-visual-c-sharp-compiler-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!