I've checked Debug plugin discovery and tried restarting Apache and setting $settings['class_loader_auto_detect'] = FALSE; in settings.php, with no change.
I have a custom module. Setting a breakpoint anywhere that I know should fire works, including the config form for my module.
The module defines a plugin of the annotated type, and I cannot get any code in the plugin manager to fire. I also note that I've used a contrib module as a model, and cannot get code in its plugin manager to break either.
If I refer to the module as 'x', in x/src/XManager.php I have:
namespace Drupal\x;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\x\Annotation\X;
/**
* Class XManager
*
* @package \Drupal\x
*/
class XManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
$subdir = 'Plugin/X';
$plugin_interface = XInterface::class;
$plugin_definition_annotation_name = X::class;
parent::__construct($subdir, $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name);
$this->alterInfo('x_info');
$this->setCacheBackend($cache_backend, 'x_plugins');
}
}
and in x/src/Annotation/X.php
namespace Drupal\x\Annotation;
use Drupal\Component\Annotation\Plugin;
/**
* @see plugin_api
*
* @Annotation
*/
class X extends Plugin {
/**
* The plugin ID.
*
* @var string
*/
public $id;
/**
* The plugin label.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $label;
/**
* The plugin field type IDs.
*
* @var array
*/
public $field_type_ids = [];
}
and in x/src/Plugin/X/XTest.php
namespace Drupal\x\Plugin\XTest;
/**
* Class XTest.
*
* @X(
* id = "x_test",
* label = @Translation("X Test"),
* field_types = {
* "text",
* "text_long",
* "text_with_summary",
* },
*
* )
*/
class XTest {
}