Fields decorated with the ContextMenuItem attribute are not unused.
IDE0051 - Remove unused private members
using UnityEngine;
class Camera : MonoBehaviour
{
[ContextMenuItem("Foo", "Bar")]
private string contextMenuString = "";
}The IDE cannot detect any references to contextMenuString in the class.
contextMenuString is used indirectly by Unity, which is undetectable by the IDE.