Code Analysis is no longer working in Visual Studio Community 2022 17.6.4

Axon Genesis 5 Reputation points
2023-07-03T23:35:01.16+00:00

As mentioned in the title I'm using Visual Studio Community 2022 17.6.4 for Unity C# development, however I can no longer get Code Analysis to provide suggestions, warnings, nor errors. When I run Code Analysis, it runs, but there are no results. When I perform a build, none of the code issues are flagged.

I've tried creating a fresh default URP project in Unity 2022.3.4, added the below simple script which breaks some of the Unity rules, but code analysis is not flagging it. IntelliSense shows me there is an issue if I select the specific lines, but I want to analyze my entire solution.

I've verified that my assembly references include Microsoft.Unity.Analyzers, using default settings. I've also tried creating an editorconfig file, but no luck.

All of this was working not too long ago and I'm not sure at what point it stopped working. I tried rolling back to 17.6.2 but no different. I then fully uninstalled and reinstalled VS Community 17.6.4 and reset all setting to default, but still no luck. 

using UnityEngine;  [RequireComponent(typeof(Rigidbody))] public class TestBehavior : MonoBehaviour {     void Start()     {     }      void Update()     {         Rigidbody body = GetComponent<Rigidbody>();          if (gameObject.tag == body.gameObject.tag) {             Debug.Log("TEST " + Time.fixedDeltaTime);         }     } } 
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,044 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 28,661 Reputation points Microsoft Vendor
    2023-07-04T10:13:03.85+00:00

    Hi @Axon Genesis

    Welcome to Microsoft Q&A! 

    Do you mean that the Code Analysis errors or warnings are not listed in “Error List” window? 

    Please open the “Error List” window and switch to “Entire Solution”.

    User's image

    Besides, you can right-click on your project > Properties > Code Analysis > Configure rule set

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.