A plugin that I have written is not being discovered.
For eg : https://www.drupal.org/node/2847639
Is there a general suggestion for debugging failing plugin discovery?
Most of the time it is because the file is not picked up, there are a few common cases for that:
Ensure that the filename matches the class name exactly, case sensitive. Without the extension of course.
Ensure that the namespace matches the folder path exactly, case sensitive.
Restart Apache to clear apcu cache, I've had issues with this when renaming/moving files with a class quite a bit in Drupal 8. Also setting class_loader_auto_detect to FALSE in settings.php should solve this one.
There are even more things to check if you're actually the one providing the plugin type such as the plugin manager.
Additionally to the bullet points in the accepted answer...
Ensure that the structure of the comment is correct, not only the layout of the annotation section, but the layout of the comment block itself (including the number of asterisk) is also important. Remembering the Annotation class is itself an annotated class.
I was having the same issue as this question, and ended up with 'print_r' statements littered throughout the getDefinitions() function mentioned in a comment in the first question to determine where it falied. That made me look at my Annotation class and realize the comment block was started with '/*' instead of '/**'
I would put this a comment, but I don't have the required reputation.