Component Visualizers breaks after compiling and restarting the Unreal editor

I did this tutorial and also tried this Git repository and they both have the same problem.
But when I add a Component Visualizer to my project and I compile it in the editor and then restart the editor.
The editor crashes and I get this error:

Assertion failed: Object->HasAnyFlags(
RF_BeginDestroyed ) &&
!Object->HasAnyFlags(
RF_FinishDestroyed )

The weird part is when I compile the project in Visual Studio I can open the editor without any errors.

I’m pretty new to Unreal C++, but does Unreal Editor compiles differently than the Visual Studio one? Is there a setting or something so that Editor also build Editor only code?