Search Issue Tracker

By Design

Votes

0

Found in

2020.3.4f1

2020.3.11f1

Issue ID

1366242

Regression

Yes

[2020.3] Compiler errors are thrown in console when using Roslyn analyzers in Editor

Scripting

-

Reproduction steps:
1. Download the attached project: "repro_project.zip"
2. Delete the Library folder from the project directory
3. Open the project

Expected result: The project opens without issue
Actual result: The project opens, but there are a bunch of compiler errors in the Console

Reproducible with: 2020.3.4f1, 2020.3.19f1
Not reproducible with: 2019.4,31f1, 2020.3.3f1, 2021.1.23f1, 2021.2.0b14, 2022.1.0a11

Notes:
- Reproduced on Linux, macOS, and Windows
- Upon opening the project a second time, the errors are absent
- Examples of possible errors:
Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/Raycasters/PhysicsRaycaster.cs(49,24): error UNT0007: Unity objects should not use null coalescing.
Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Graphic.cs(488,17): error UNT0003: Method 'GetComponents' has a preferred generic overload.
Library/PackageCache/com.unity.test-framework@1.1.29/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs(98,17): error UNT0008: Unity objects should not use null propagation.

  1. Resolution Note (2020.3.X):

    This is intended behaviour.
    If a analyzer is needed to only run on specific assemblies, the recommended way is to use Analyzer Scope. Documentation found here: https://docs.unity3d.com/Manual/roslyn-analyzers.html

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.