VSTPluginInstance gets called twice

Not sure if I am doing something wrong or if this is intended as it is necessary for plugin scanning, but in VSTPluginInstance gets called twice when I host a VST2 plugin.

VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::AEffect* effect,
double sampleRateToUse, int blockSizeToUse)

My code for loding it loooks like this:

juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()

juce::OwnedArrayjuce::PluginDescription pluginDescriptions;
juce::KnownPluginList plist;
juce::AudioPluginFormatManager pluginFormatManager;

//here it gets called for the first time, then it is destroyed
for (int i = 0; i < pluginFormatManager.getNumFormats(); ++i)
    plist.scanAndAddFile(pluginPath, true, pluginDescriptions, *pluginFormatManager.getFormat(i));

juce::String msg;
//here it gets called for the second time
auto wrapped = pluginFormatManager.createPluginInstance(*pluginDescriptions[0], 44100.0, 512, msg);
return std::make_unique<WrapperProcessor>(std::move(wrapped)).release();  


Here is a thread that could be related to it:

It’s normal/expected and you have to deal with it. I can quickly locate several threads about it (and there are more IIRC):