"Invalid operation during scanning" - debug a plugin that won't load?

I’m trying to sort through debugging in general.
I have VS 2017 and I directed it to Reaper, with Attach = yes.
The vst3 file compiles fine. I copied it to where Reaper can find it, and Reaper finds it, but the first thing it says on starting is that the plugin performed an invalid operation while scanning. It is not on the list of available plugins.
VS doesn’t give me any warning that my breakpoints won’t be hit. It sees nothing wrong anywhere.

The plugin itself is only attempting to load another plugin, based on code posted here a while back. I direct it in the code to the name of another plugin in the same directory, if that matters. Until I can actually debug it, I can’t begin to tell where it’s going wrong, or if it will even be possible to do this.

Is there a way for VS to debug the plugin… before it loads in a host??
Thank you.

Don’t do any of that manual “attach” stuff when debugging. Set Reaper (or whatever other host you may be using) as the “command” to be used when starting debugging. (In the Visual Studio project settings.) That allows you to easily catch problems that happen when the host is starting and doing its initial scan of the plugins. If the plugin already crashed while Reaper was trying to scan it, it was probably added into the blacklisted plugins, so you have the edit the ini-file of Reaper that has them. (Or maybe a full rescan done from the preferences will do the same thing…)

Some plugins will fail when trying to use them under the debugger. (Typically iLok protected ones.) That’s a very miserable situation to deal with…If that is the situation, it’s best to try hosting some other plugin for testing purposes.

You can also build your plugin as a standalone application which can make testing and debugging easier and faster in some instances. (You need to change your Projucer project to have the standalone app build enabled, re-export the Visual Studio solution and rebuild.)

Thank you once again. With that knowledge, it was finally simpler to use the Juce Audio Plug-in Host, making it rescan and watching Visual Studio.
For others finding this, if you do as Xenakios says, then right-clicking the plugin project and choosing “Debug->Start new instance” will start debugging your plugin. I was annoyed that using the obvious buttons to start debugging always ran a standalone that I didn’t want (but which appeared automatically on creating the VS project from Projucer).

For anyone else having trouble getting a plugin to load a plugin, the problem I was having was that there is a THIRD place to set format options in Projucer. I.e., you need to set File-Global Paths to VST3 SDK (in this case), and you also have Plug-in Format settings in View->Show Project Settings to enable MIDI input, etc., but to load the hosting classes, you have to select the juce_audio_processors module under the Modules pane and enable whichever host format you need, e.g. JUCE_PLUGINHOST_VST3.

The official advice was always to leave the VST3_SDK empty in the project AND in the Global File Paths, so the built in VST3 headers of JUCE are used.
Does that not work for you?