dotnet / roslynator

Roslynator is a set of code analysis tools for C#, powered by Roslyn.
https://josefpihrt.github.io/docs/roslynator
Other
3.1k stars 261 forks source link

"roslynator_unity_code_analysis.enabled = true" not working for RCS1213 #1577

Closed Trisibo closed 3 days ago

Trisibo commented 2 weeks ago

I added the line roslynator_unity_code_analysis.enabled = true on the ".editorconfig" file at the root of a Unity project, but I still get the "RCS1213: Remove unused method declaration" on the Start method in this code in Visual Studio:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class _TEST_ : MonoBehaviour
{
    IEnumerator Start()
    {
        yield return new WaitForSeconds(1);
        Debug.Log("Meow");
    }
}

I also tried adding the line to the ".roslynatorconfig" file, with the same result.

I don't know if there are other warnings that aren't disabled in Unity projects.

It's the Roslynator 2022 extension version 4.12.9, on Visual Studio 17.11.5.

josefpihrt commented 4 days ago

The issue is that Roslynator expects Unity methods to return void. But it seems that Start method returns IEnumerator.