Scanner crashing on unloadable plugins (w licenses for other apps)

I’m using a PluginDirectoryScanner

			PluginDirectoryScanner *PlugScanner = new PluginDirectoryScanner(knownPluginList,*ap,SearchFolders,true,DeadFile,false);
			while(PlugScanner->scanNextFile(true,PlugName) == true) ;

to search a directory for plugins. If all of the plugins are loadable (including mine) it works fine, I get the list of plugins and can instantiate them and bring up their guis.

But if they can not be loaded due to license restrictions, the app craashes , including in the debugger, it just exits debugging.

I tracked it down to juce_VST3PluginFormat.cpp line 1194
bool open (const String& filePath)
if ( (filePath))
typedef bool (PLUGIN_API *InitModuleProc) ();

        if (InitModuleProc proc = (InitModuleProc) getFunction ("InitDll"))
            if (proc())  (-- proc comes back from above line ok, but then dies here)
                return true;

I also tried using a PluginListComponent. When I did, and scanned these folders, I got a blank dialog appearing and then it crashed or just hung. Again, it works fine if I don’t scan folders with plugins that won’t load.
Saw same issue with VST3 and VST plugins.

I assume the dialog is part of PluginListComponent? Or is the plugin trying to put up a warning itself?
What am I missing to trap or allow the error to be expressed (or skipped)?
I just want to skip these special licensed plugins, without crashing and making scanning impossible.

It all works great until a plugin refuses to load.
They are all plugins that work with Sonar or Cubase and are licensed. I’m having no issue loading my own plugins.

Some plugins may be detecting the fact that you’re running in a debugger and deliberately crashing.

But yes, some plugins will indeed crash, fail, or just do stupid stuff when you scan them. That’s why the scanner classes have a black-list to avoid scanning the second time when your app re-starts, and why it has hooks to let you arrange for it to run as a child process, like we do in tracktion.

Thanks, explains why I couldn’t work around it.
Is it possible to run just the scanning as a child process? Any example of doing this in the example/demo code?

I see where you have created ScanJob to run the scans in your PluginListComponent, but I can’t find where you are craeting the error dialogs, nor why they would crash when I use the PluginListComponent. I see why mine is crashing, without the backgroupnd thread jobs,but PluginListComponent looks like it should work on its own to build the good and bad lists without crashing. Where are the failure diaplog being created??

Well what’s the stack trace for these crashes? Presumably they’re the plugin?

The only stack trace I’ve gotten is a very short one within a timer wait,with no link back to my code.
I’ll enable the PluginListComponent again and see what I get, but I believe when I tried that in the debugger, the debugger just stopped running. Very frustrating.

I have rewritten the loader using the a background thread which runs the doNextScan -

bool doNextScan()
    if (scanner->scanNextFile (true, pluginBeingScanned))
        return true;

    finished = true;
    return false;

Works great until it hits a plugin it can’t load.
I’m missing something basic here - how does a separate thread allow me to catch a crash?
It does write the last one that crashed to the DeadFile and I can run again, skipping that file and they load.

I’m trying to stay within the JUCE framework and avoid forking off a Windows process to stay Mac compatible.
But I’m missing a piece here - how can I kick off a task and then check to see if it fails? Without the app crashing?
I see how you are spawing the threads and how they work, but I can’t figure out where and how the failure is being trapped. Can you point me to that?

My own test vst3 is the Jupiter6 plugin, plus the Arpeggiator example plugin and a Yamaho Motif editor, all of which load fine. The Celemony/Melogyne is licenced and is what I’m using for the ‘fail’ plugin to try and get around it. It hits the license dll and dies.

The debugger just stops and exits debug mode. I get the following shutdown info, but no stack trace.

JUCE v4.2.4
’GreenbriarMidiDAW.exe’ (Win32): Loaded ‘C:\Program Files (x86)\Common Files\vst3\Yamaha\MOTIF XF.vst3’. Cannot find or open the PDB file.
‘GreenbriarMidiDAW.exe’ (Win32): Unloaded ‘C:\Program Files (x86)\Common Files\vst3\Yamaha\MOTIF XF.vst3’
‘GreenbriarMidiDAW.exe’ (Win32): Loaded ‘C:\Program Files (x86)\Common Files\vst3\Yamaha\Arpeggiator.vst3’. Symbols loaded.
JUCE v4.2.4
’GreenbriarMidiDAW.exe’ (Win32): Unloaded ‘C:\Users\David\Documents\JUCE Projects\GreenbriarMidiDAW\Builds\VisualStudio2012\Debug\Plugins\Jupiter6EditorPlugin.vst3’
‘GreenbriarMidiDAW.exe’ (Win32): Unloaded ‘C:\Program Files (x86)\Common Files\vst3\Yamaha\Arpeggiator.vst3’
‘GreenbriarMidiDAW.exe’ (Win32): Unloaded ‘C:\Windows\SysWOW64\msvcp110d.dll’
‘GreenbriarMidiDAW.exe’ (Win32): Unloaded ‘C:\Windows\SysWOW64\msvcr110d.dll’
‘GreenbriarMidiDAW.exe’ (Win32): Loaded ‘C:\Windows\SysWOW64\msimg32.dll’. Cannot find or open the PDB file.
‘GreenbriarMidiDAW.exe’ (Win32): Loaded ‘C:\Program Files (x86)\Common Files\Celemony\iLok Support\Melodyne editor.dll’. Module was built without symbols.
‘GreenbriarMidiDAW.exe’ (Win32): Loaded ‘C:\Users\David\AppData\Local\Temp\PILAA8A.tmp’. Module was built without symbols.
The thread 0x3b54 has exited with code 16 (0x10).
The thread ‘Pool’ (0x3b68) has exited with code 16 (0x10).
The thread ‘Juce Timer’ (0x2cd8) has exited with code 16 (0x10).
The thread ‘thumb cache’ (0x12b8) has exited with code 16 (0x10).
The thread 0x2b18 has exited with code 16 (0x10).