Skip to content

Problem with DI registering Tracy on project without Debugger enabled #245

@paranoiq

Description

@paranoiq

i have quite specific use-case: i am using Tracy\Debugger and Dumper in my remote dumper. the remote dumper is auto-prepended in php config. it includes either its own Tracy or Tracy from the project it is used on.

so far everything worked ok, until i started using an app which does use Nette\DI, but does not use Tracy.

DIExtension detects Tracy just by checking for existence of IBarPanel interface and then it fails because it tries to get from DI container the BarPanel service, which is not there, because neither Configurator::enableDebugger() nor Debugger::enable() was called.

i could make (and will make) some workaround, but still have to ask: is this the right or the only way to detect Tracy? should mere existence of a class trigger an action when there are methods specifically designed to enable Debugger? 🤔

where it happens:

if ($this->debugMode && $this->config->debugger) {
     $this->enableTracyIntegration();
}

after some thought, i think some $container->hasService() would fix it? but i am not sure how the compilation works and when is the right time...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions