Search Issue Tracker


Fixed in 2022.2.20f1, 2023.1.0b17, 2023.2.0a16



Found in




Issue ID




Scripts are seen by Roslyn analyzer despite limiting the scope of analyzers



How to reproduce:
1. Open the project ““
2. Observe the errors in the Console

Expected result: There are no errors
Actual result: There are errors regarding Unity.SourceGenerators

Reproducible with: 2022.2.0a12, 2022.2.15f1, 2023.1.0b12, 2023.2.0a10
Not Reproducible with: 2020.3.47f1, 2021.3.22f1, 2022.2.0a11

Reproducible on: Windows 10, Linux 6.1.7-arch1-1.1

Workaround: Put scripts in a different package (without the Roslyn analyzer).

Comments (1)

  1. Tallek

    May 22, 2023 13:52

    I'm not sure this has been completely fixed yet. We have a project in 2021 that made use of some Roslyn analyzers and everything was working fine. After upgrading to 2022.18/19, Unity was hanging during compilation. Checking the editor log, it was full of thousands of warnings from these analyzers (deleting the analyzers would fix it).

    After upgrading to 2022.2.20 (labeled as fixed above), the hang went away, as did the warnings in the log, however compilation would take a very long time. One particular assembly was taking 3.5 minutes to finish compiling whereas it was taking a couple seconds before. If I update our StyleCop analyzer ruleset to disable all rules, compilation returns to its normal 2 second time.

    This seems to imply that the analyzers are still running for generated code.

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.